LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Unprotect worksheet method in VBA

Jim,

works like a charm!

Thanks a bunch!


-----Original Message-----
Bhupinder Rayat,

Something like this ?...
'--------------------------------------
Sub SheetProtectTest()
ActiveSheet.Unprotect
If ActiveSheet.ProtectContents = True Then
MsgBox "Still Protected"
Exit Sub
Else
MsgBox "Sheet Unprotected"
'do stuff
End If
End Sub
'--------------------------------------
Regards,
Jim Cone
San Francisco, USA


"Bhupinder Rayat"

wrote in
message ...
Hi all,
I am using the unprotect method in VBA (on a sheet
containing a password);
ActiveSheet.Unprotect
which brings up the password prompt box. If the correct
password is entered and 'OK' is pressed, the sheet is
unprotected and then I have some "further code" that
runs.
If a wrong password is entered, I have a error handler
that deals with it.
The trouble is that when the password prompt box

appears,
and I press the 'cancel' button, the "further code"

still
runs.
How can I get the code to exit the sub after

the 'cancel
button is pressed, so nothing happens?
Any help will be much appreciated.
Thanks,
Bhupinder Rayat

.

 
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
unprotect worksheet when...... Wanna Learn Excel Discussion (Misc queries) 1 December 10th 08 01:14 PM
Unprotect Worksheet. xoom3 Excel Discussion (Misc queries) 4 July 14th 06 10:00 PM
unprotect worksheet Richard Sanchez Excel Programming 1 July 17th 04 01:26 AM
Unprotect Worksheet Phil Perry Excel Programming 0 July 10th 03 01:22 PM
Unprotect method run-time error Rohit Thomas Excel Programming 0 July 8th 03 07:32 PM


All times are GMT +1. The time now is 01:17 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"