Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Locking and unlocking a workbook

I have a spreadshhet called Finance that I want to lock
and unlock using a button, what is the syntac for locking
and unlocking a workbook using code

Thanks

Nigel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Locking and unlocking a workbook

workbooks("Myworkbook.xls").Protect Password:="ABCD"

workbooks("Myworkbook.xls").Worksheets(1).Protect Password:="ABCD"

replace Protect with Unprotect to unlock them.

See help for options that can be used with the commands.

You can also protect at the file level - see the workbook SAVEAS command for
options.

Workbooks("Myworkbook.xls").SaveAs
--
Regards,
Tom Ogilvy



"Nigel Bennett" wrote in message
...
I have a spreadshhet called Finance that I want to lock
and unlock using a button, what is the syntac for locking
and unlocking a workbook using code

Thanks

Nigel



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
Locking/Unlocking based on another cell value Iriemon Excel Worksheet Functions 0 March 27th 08 02:47 PM
locking and unlocking worksheets adam Excel Worksheet Functions 6 October 31st 07 05:31 PM
Locking/Unlocking cells upon condition Brettjg Excel Discussion (Misc queries) 20 March 12th 07 06:01 AM
Locking/unlocking cells Ian Coates Excel Programming 1 February 3rd 04 04:04 PM
Locking/Unlocking a VBA Project in 2000 vs '97 - Difference? RobNew Excel Programming 3 November 2nd 03 07:29 AM


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