Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
petunia
 
Posts: n/a
Default Running Macros in protected workbook

I have a macro in a protected workbook that won't work correctly with it
protected, how can I get the macro's to work
  #2   Report Post  
Paul B
 
Posts: n/a
Default

petunia, you could unprotect the sheet run your code and then protect the
sheet like this

ActiveSheet.Unprotect password:="123"

'you code here

ActiveSheet.Protect password:="123"



or protect it with user interface only, like this then the macros will run,
this will have to be set each time the workbook is opened

ActiveSheet.Protect UserInterfaceOnly:=True, password:="123"
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"petunia" wrote in message
...

I have a macro in a protected workbook that won't work correctly with it
protected, how can I get the macro's to work



  #3   Report Post  
petunia
 
Posts: n/a
Default

when I send this to someone, I don't want them to make changes to the other
sheets, will this allow them to run the macro's but not make changes of any
other kind, and keep the rest of the sheet protected

"Paul B" wrote:

petunia, you could unprotect the sheet run your code and then protect the
sheet like this

ActiveSheet.Unprotect password:="123"

'you code here

ActiveSheet.Protect password:="123"



or protect it with user interface only, like this then the macros will run,
this will have to be set each time the workbook is opened

ActiveSheet.Protect UserInterfaceOnly:=True, password:="123"
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"petunia" wrote in message
...

I have a macro in a protected workbook that won't work correctly with it
protected, how can I get the macro's to work




  #4   Report Post  
Paul B
 
Posts: n/a
Default

Petunia, Yes, the sheet will be protected in the same way as if you
protected it yourself, the user will not know that the sheet is being
unprotected and then protected when the macro is run so the sheet will be
locked any time the macro is not running, if you use the user interface only
this will let the macros run on a protected sheet.

You may want to reference a sheet like this instead of the active sheet like
this

Worksheets("sheet1").Protect UserInterfaceOnly:=True, password:="123"

Be aware that sheet protection is very weak in excel, but it will keep
someone form accidentally messing up your data.



You may want to protect the VBA project so others will not see the password
in it, from your workbook right-click the workbook's icon and pick View
Code. This icon is to the left of the "File" menu this will open the VBA
editor, in the left hand window right click on your workbook name and select
VBA project properties, protection, check lock project for viewing and set a
password. Press Alt and Q to close this window and go back to your workbook
and save and close the file.
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003




"petunia" wrote in message
...
when I send this to someone, I don't want them to make changes to the
other
sheets, will this allow them to run the macro's but not make changes of
any
other kind, and keep the rest of the sheet protected

"Paul B" wrote:

petunia, you could unprotect the sheet run your code and then protect the
sheet like this

ActiveSheet.Unprotect password:="123"

'you code here

ActiveSheet.Protect password:="123"



or protect it with user interface only, like this then the macros will
run,
this will have to be set each time the workbook is opened

ActiveSheet.Protect UserInterfaceOnly:=True, password:="123"
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"petunia" wrote in message
...

I have a macro in a protected workbook that won't work correctly with
it
protected, how can I get the macro's to work






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
Autofilter on protected workbook Wes Excel Discussion (Misc queries) 1 January 20th 05 11:06 PM
Is is possible to run macros on a protected worksheet petunia Excel Worksheet Functions 1 January 18th 05 04:55 PM
can a workbook with macros created in excel 2003 work in excel 20. Steve Venti Excel Discussion (Misc queries) 2 December 27th 04 02:31 PM
How can I save an editable copy of a protected excel workbook? randyice Excel Discussion (Misc queries) 1 December 23rd 04 09:01 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 04:08 PM.

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"