Document.ProtectionType (Propiedad) (2007 System)

Actualización: noviembre 2007

Obtiene el tipo de protección para el documento.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word.v9.0 (en Microsoft.Office.Tools.Word.v9.0.dll)

Sintaxis

Public ReadOnly Property ProtectionType As WdProtectionType

Dim instance As Document
Dim value As WdProtectionType

value = instance.ProtectionType
public WdProtectionType ProtectionType { get; }

Valor de propiedad

Tipo: Microsoft.Office.Interop.Word.WdProtectionType

El tipo de protección devuelto puede ser una de las constantes WdProtectionType siguientes: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions o wdNoProtection.

Ejemplos

En el ejemplo de código siguiente se comprueba si se ha establecido la protección para el documento. Si no, el código establece la protección de modo que sólo se permitan comentarios.

Se trata de un ejemplo para una personalización en el nivel del documento.

Private Sub DocumentProtectionType()
    If Me.ProtectionType = Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection Then
        Me.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyComments)
    End If
End Sub 
private void DocumentProtectionType()
{
    if (this.ProtectionType == Microsoft.Office.Interop.
        Word.WdProtectionType.wdNoProtection)
    {
        this.Protect(Microsoft.Office.Interop.Word.
            WdProtectionType.wdAllowOnlyComments, 
            ref missing, ref missing, ref missing,
            ref missing);
    }
}

Permisos

Vea también

Referencia

Document (Clase)

Document (Miembros)

Microsoft.Office.Tools.Word (Espacio de nombres)