Share via


Propiedad Worksheet.Protection (Excel)

Devuelve un objeto Protection que representa las opciones de protección de la hoja de cálculo.

Sintaxis

expresión. Protección

Expresión Variable que representa un objeto Worksheet .

Ejemplo:

Este ejemplo protege la hoja de cálculo activa; a continuación, determina si se pueden insertar columnas en la hoja de cálculo y comunica al usuario este estado.

Sub CheckProtection() 
 
 ActiveSheet.Protect 
 
 ' Check the ability to insert columns on a protected sheet. 
 ' Notify the user of this status. 
 If ActiveSheet.Protection.AllowInsertingColumns = True Then 
 MsgBox "The insertion of columns is allowed on this protected worksheet." 
 Else 
 MsgBox "The insertion of columns is not allowed on this protected worksheet." 
 End If 
 
End Sub

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.