Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Unprotect shet, Password missed!

Hi guys.

I´ve got the following code for unprotecting my sheets.
The problem is when i miss the password! Excell doesn´t
ask for it again or Stops the macro. It appears a Window
asking me to end or debug!

Sheets("GESTÃO").Select
ActiveSheet.Unprotect
Rows("7:11").Select
Selection.EntireRow.Hidden = False
Range("A1").Select
Sheets("ORÇAMENTO").Select
ActiveSheet.Unprotect
Rows("5:10").Select
Selection.EntireRow.Hidden = False
Range("A1").Select
Sheets(" AJUDA ! ").Select
Range("A1").Select

How can i make excell ask me for the passWord again or
simply stops the macro(or run another macro)

Thanks a lot!!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Unprotect shet, Password missed!

SpeeD,

The error message is the result of trying to hide columns
on a sheet that didn't get unprotected.
You could place an
On Error Resume Next
at the beginning of your code and
On Error GoTo 0
at the end.
That will stop the error window from popping up but still
won't unprotect the sheet (or hide the columns).
Suggestion:
Why not include the password in the code???
ActiveSheet.Unprotect Password:="yourpassword"

John

SpeeD wrote:

Hi guys.

I´ve got the following code for unprotecting my sheets.
The problem is when i miss the password! Excell doesn´t
ask for it again or Stops the macro. It appears a Window
asking me to end or debug!

Sheets("GESTÃO").Select
ActiveSheet.Unprotect
Rows("7:11").Select
Selection.EntireRow.Hidden = False
Range("A1").Select
Sheets("ORÇAMENTO").Select
ActiveSheet.Unprotect
Rows("5:10").Select
Selection.EntireRow.Hidden = False
Range("A1").Select
Sheets(" AJUDA ! ").Select
Range("A1").Select

How can i make excell ask me for the passWord again or
simply stops the macro(or run another macro)

Thanks a lot!!!


Reply
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 password in VBA view exalan Excel Worksheet Functions 1 March 4th 10 01:05 PM
How do I unprotect a workbook without the password? FJBSD Excel Discussion (Misc queries) 1 March 29th 08 11:49 PM
Unprotect password- forgot? JW Excel Worksheet Functions 4 February 29th 08 04:56 AM
Password - Protect, UnProtect MrAlMackay Excel Programming 5 January 19th 05 07:23 PM
Password Unprotect Bob Tulk Excel Programming 0 July 29th 03 02:53 PM


All times are GMT +1. The time now is 05:42 PM.

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

About Us

"It's about Microsoft Excel"