G
Gleam
Private Sub Prot()
' Purpose of this macro is to show a possible problem with Excel 2003
' (Visual Basic 6.3 Version 9972)
' Select another workbook and run this macro twice. First time OK. Second
' time protection is removed from workbook.
For i1 = 1 To ActiveWorkbook.Sheets.Count
Worksheets(i1).Protect ("PWord7")
Next i1
' Next lines will remove protection second time macro is run - but should not
On Error Resume Next
ActiveWorkbook.Protect ("PWord7")
ie = Err.Number ' 1004=already protected?
On Error GoTo 0
End Sub
Private Sub Prot2()
' Purpose of this macro is to show 2 possible problems with Excel 2003
' (Visual Basic 6.3 Version 9972)
' Next line is rejected by Auto Syntax Check
activeworkbook.Protect ("PWord3",True,True)
' structure is not picked up as a key word in next line
ActiveWorkbook.Protect Password:="PWord4", structure:=True, Windows:=True
End Sub
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...25df458&dg=microsoft.public.excel.programming
' Purpose of this macro is to show a possible problem with Excel 2003
' (Visual Basic 6.3 Version 9972)
' Select another workbook and run this macro twice. First time OK. Second
' time protection is removed from workbook.
For i1 = 1 To ActiveWorkbook.Sheets.Count
Worksheets(i1).Protect ("PWord7")
Next i1
' Next lines will remove protection second time macro is run - but should not
On Error Resume Next
ActiveWorkbook.Protect ("PWord7")
ie = Err.Number ' 1004=already protected?
On Error GoTo 0
End Sub
Private Sub Prot2()
' Purpose of this macro is to show 2 possible problems with Excel 2003
' (Visual Basic 6.3 Version 9972)
' Next line is rejected by Auto Syntax Check
activeworkbook.Protect ("PWord3",True,True)
' structure is not picked up as a key word in next line
ActiveWorkbook.Protect Password:="PWord4", structure:=True, Windows:=True
End Sub
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...25df458&dg=microsoft.public.excel.programming