Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activebook.Unprotect in macro giving errors (Pwd)#2
(Sorry if duplicated but network went down 1st time)
I have two pieces of code in workbook & cant see what I am doing wrong. The first (seems to work) should hide a specific sheet & then protect the workbook to stop unauthorised users from viewing Sub Hide() On Error Resume Next Sheets(2).Select ActiveWindow.SelectedSheets.Visible = False ActiveWorkbook.Protect Structu=True, Windows:=False, Password:="Mypassword" End Sub The 2nd should allow a user who HAS PASSWORD to unprotect the workbook & display the hidden sheet, but keeps aborting.. Sub Show() ' ActiveWorkbook.Unprotect Sheets(2).Visible = True End Sub Everytime I try to run it aborts and gives "Run-time error '1004': The password supplied is incorrect......" (BUT I HAVEN'T EVEN BEEN PROMPTED FOR A PASSWORD!?) What am I doing wrong? Thanks Using Excel 2007, but wb is 2003 Compatible) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using Activebook.Unprotect in macro giving errors (Password) | Excel Programming | |||
Range().resize giving errors | Excel Programming | |||
Range().resize giving errors | Excel Programming | |||
Range().resize giving errors | Excel Programming | |||
Macro giving errors at workbook open | Excel Discussion (Misc queries) |