AW: Einstellungen Blattschutz anzeigen
01.09.2010 02:11:49
fcs
Hallo Norman,
soweit ich bisher gesehen habe werden beim erneuten Setzen des Blattschutzes im Dialogfenster die vorherigen Einstellungen angezeigt.
Mit dem folgenden Makro kannst du die Einstellungen eines geschützten Blatts ermitteln.
Ich weiss nicht, ob unter Excel 2003 schon die gleichen Einstellungen möglich waren, wie unter 2007. Es könnte also sein, das du die eine oder andere Code-Zeile rausnehmen muss.
Gruß
Franz
Sub BlattSchutzeinstellungen()
' Erstellt unter Excel 2007
Dim wks As Worksheet, a(1 To 16, 0 To 1), sMsgText As String, iIndex As Long
Set wks = ActiveSheet
a(1, 0) = "AllowDeletingColumns: "
a(1, 1) = wks.Protection.AllowDeletingColumns
a(2, 0) = "AllowDeletingRows:"
a(2, 1) = wks.Protection.AllowDeletingRows
a(3, 0) = "AllowEditRanges (Anzahl): "
a(3, 1) = wks.Protection.AllowEditRanges.Count
a(4, 0) = "AllowFiltering: "
a(4, 1) = wks.Protection.AllowFiltering
a(5, 0) = "AllowFormattingCells: "
a(5, 1) = wks.Protection.AllowFormattingCells
a(6, 0) = "AllowFormattingColumns: "
a(6, 1) = wks.Protection.AllowFormattingColumns
a(7, 0) = "AllowFormattingRows: "
a(7, 1) = wks.Protection.AllowFormattingRows
a(8, 0) = "AllowInsertingColumns: "
a(8, 1) = wks.Protection.AllowInsertingColumns
a(9, 0) = "AllowInsertingHyperlinks: "
a(9, 1) = wks.Protection.AllowInsertingHyperlinks
a(10, 0) = "AllowInsertingRows: "
a(10, 1) = wks.Protection.AllowInsertingRows
a(11, 0) = "AllowSorting: "
a(11, 1) = wks.Protection.AllowSorting
a(12, 0) = "AllowUsingPivotTables: "
a(12, 1) = wks.Protection.AllowUsingPivotTables
a(13, 0) = "ProtectDrawingObjects: "
a(13, 1) = wks.ProtectDrawingObjects
a(14, 0) = "ProtectScenarios: "
a(14, 1) = wks.ProtectScenarios
a(15, 0) = "ProtectContents: "
a(15, 1) = wks.ProtectContents
a(16, 0) = "ProtectionMode(UserInterfaceOnly): "
a(16, 1) = wks.ProtectionMode
sMsgText = "Einstellungen Blattschutz" & vbNewLine
For iIndex = 1 To UBound(a)
sMsgText = sMsgText & vbNewLine & a(iIndex, 0) & a(iIndex, 1)
Next
MsgBox sMsgText, vbInformation + vbOKOnly, "Schutzeinstellungen für aktives Blatt"
End Sub