Excel 2000 error

A

AMK4

Can someone explain to me why this fails in Excel 2000? They're getting
an error: *Microsoft Visual Basic Compile Error: Named Argument Not
Found*
Code:
--------------------
Private Sub Workbook_Open()
Dim wSheet As Worksheet
Application.ScreenUpdating = False
If Worksheets("MasterData").Visible = True Then
' MasterData is visible, keep everything veryhidden
For Each wSheet In Worksheets
wSheet.Unprotect Password:="cookies2006"
wSheet.EnableSelection = xlUnlockedCells
If wSheet.Name <> "MasterData" Then
wSheet.Protect Password:="cookies2006", Contents:=True, UserInterfaceOnly:=True
wSheet.Visible = xlSheetVeryHidden
Else
wSheet.Protect Password:="cookies2006", Contents:=True, UserInterfaceOnly:=True, AllowFormattingColumns:=True
wSheet.Visible = xlSheetVisible
End If
Next
Else
' MasterData has been hidden, don't hide other sheets
For Each wSheet In Worksheets
If wSheet.Visible = True Then
' the sheet's not hidden, un/relock, don't hide
wSheet.Unprotect Password:="cookies2006"
wSheet.EnableSelection = xlUnlockedCells
wSheet.Protect Password:="cookies2006", Contents:=True, UserInterfaceOnly:=True
End If
Next
End If
Application.ScreenUpdating = True
End Sub
 
T

Tom Ogilvy

Because the option to allowformattingcolumns wasn't introduced until xl2002.
It isn't supported in xl2000 and xl2000 knows nothing about the argument.

--
Regards,
Tom Ogilvy



AMK4 said:
Can someone explain to me why this fails in Excel 2000? They're getting
an error: *Microsoft Visual Basic Compile Error: Named Argument Not
Found*
Code:
--------------------
Private Sub Workbook_Open()
Dim wSheet As Worksheet
Application.ScreenUpdating = False
If Worksheets("MasterData").Visible = True Then
' MasterData is visible, keep everything veryhidden
For Each wSheet In Worksheets
wSheet.Unprotect Password:="cookies2006"
wSheet.EnableSelection = xlUnlockedCells
If wSheet.Name <> "MasterData" Then
wSheet.Protect Password:="cookies2006", Contents:=True, UserInterfaceOnly:=True
wSheet.Visible = xlSheetVeryHidden
Else
wSheet.Protect Password:="cookies2006", Contents:=True,
UserInterfaceOnly:=True, AllowFormattingColumns:=True
 
J

Jim Thomlinson

AllowFormattingColumns is not valid in xl2000. I think it started in xl2002
(not sure)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top