LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Protect Workbook Code Queres

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", structu=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/comm...el.programming
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can protect worksheet then workbook but not Protect and Share in code [email protected] Excel Programming 7 January 16th 17 07:01 AM
Protect Workbook Vs Protect Sheet Poor_pakistani New Users to Excel 4 May 25th 06 02:06 PM
Disable Tools, Protect, Protect Workbook Paul Moles Excel Programming 1 September 5th 05 03:37 PM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
Password Protect Workbook via code John Wilson Excel Programming 1 October 9th 03 05:18 PM


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"