Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Don,
To add to JMB's reply, v2002 took a big leap over v2000 by adding the protection class, and its associated options. Ordinarily, protection options applied in v2002 and later would be ignored in v2000 as "backward compatibility" usually provides that. A problem will arise trying to "programmatically" apply these options if your project is run in v2000 using the later version options. Here's a sub that encapsulates this issue and some of the most common non-persistent properties. You can use it for both v2000 and later versions. Sub wksProtect() ' This lists all the members of the Protection class. ' Move rows around to list desired settings first, ' then comment out the lower (unwanted) settings. With ActiveSheet If val(Application.Version) = 10 Then .Protect Password:=gszPwrd, _ DrawingObjects:=True, _ Contents:=True, _ Scenarios:=True, _ Userinterfaceonly:=True, _ AllowFiltering:=True, _ AllowFormattingColumns:=True, _ AllowFormattingRows:=True, _ AllowDeletingColumns:=True, _ AllowDeletingRows:=True, _ AllowFormattingCells:=True, _ AllowInsertingColumns:=True, _ AllowInsertingRows:=True ', _ AllowInsertingHyperlinks:=True, _ AllowUsingPivotTables:=True Else .Protect Password:=gszPwrd, _ DrawingObjects:=True, _ Contents:=True, _ Scenarios:=True, _ Userinterfaceonly:=True 'Non-persistent:This one must be reset (all versions) when the workbook is re-opened. **Requires unprotecting first** End If 'Non-persistent settings 'These must be reset when the workbook is re-opened 'UnComment the desired setting only ' .EnableSelection = xlNoRestrictions .EnableSelection = xlUnlockedCells ' .EnableSelection = xlNoSelection .EnableAutoFilter = True ' .EnableAutoFilter = False End With 'ActiveSheet End Sub HTH Regards, Garry |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Regexp needed in Excel 2000 | Excel Discussion (Misc queries) | |||
Hyperlink in Excel 2000 can't open bookmarked Word 2000 file | Excel Discussion (Misc queries) | |||
Help needed with textbox formatting in Excel 2000 | Excel Discussion (Misc queries) | |||
Create macro to download access 2000 table to excel 2000 spreadsheet | Excel Programming | |||
MS Excel 2000 - Data Delete Help Needed | Excel Programming |