Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 76
Default Password Protect Macro - Compile Error

Please help me to discover what is wrong with this excerpt from a macro that
I am writing to protect a sheet in my workbook with a password. I keep
getting the compile error message.
__________________________________________________
ActiveSheet.Protect Password:="PASS" DrawingObjects:=True,
Contents:=True, Scenarios:=True
ActiveWindow.SelectedSheets.Visible = False

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Password Protect Macro - Compile Error

What line causes the error?

Those first two lines are really one logical line:

ActiveSheet.Protect Password:="PASS", DrawingObjects:=True, _
Contents:=True, Scenarios:=True

And you need a comma between each parameter (before drawingObjects)

The spacecharacter followed by an underscore is the continuation character in
VBA.

Teddy-B wrote:

Please help me to discover what is wrong with this excerpt from a macro that
I am writing to protect a sheet in my workbook with a password. I keep
getting the compile error message.
__________________________________________________
ActiveSheet.Protect Password:="PASS" DrawingObjects:=True,
Contents:=True, Scenarios:=True
ActiveWindow.SelectedSheets.Visible = False


--

Dave Peterson
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
Code to protect/unprotect a sheet using a macro with password FredH Excel Discussion (Misc queries) 5 October 23rd 07 04:49 PM
Using "Countif" in macro gives compile error ashish128 Excel Discussion (Misc queries) 4 June 15th 07 12:23 PM
Add protect worksheet password in macro Kelly Excel Worksheet Functions 1 January 10th 06 02:08 AM
Macro / Compile Error / Duplicate Declaration carl Excel Worksheet Functions 1 June 29th 05 08:55 PM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Excel Worksheet Functions 1 June 24th 05 02:59 PM


All times are GMT +1. The time now is 07:45 AM.

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"