Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Psswd protect a sheet automatically upon closing file

Thanks so much Dominic!!! That is perfect.

"dominicb" wrote:


Good morning Robert

You need this macro to be put into the ThisWorkbook section of your
file:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Protect password:="devide", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

If the thought of that gives you a cold sweat, here's what you do.
From XL press alt + F11, this will open the Visual Basic Editor and
find your file in the project window - top left. Look for the
ThisWorkbook section and double click on it, and copy the macro above
into the blank pane. Close the VBE and save your file. Job done.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=375555


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Psswd protect a sheet automatically upon closing file


Hi Robert

You're welcome, and I appreciate the feedback.

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=37555

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
how to setup a excel sheet to be protect after save and close file Marco Excel Discussion (Misc queries) 0 March 11th 08 10:56 PM
mail merge-word file automatically closing vishu Excel Discussion (Misc queries) 3 October 24th 05 05:03 PM
Need a psswd verification form to open when the file is opened Linking to specific cells in pivot table Excel Programming 6 May 31st 05 02:59 PM
how to let excel ask to save the sheet when closing the excel file Malek Setting up and Configuration of Excel 1 January 4th 05 12:13 AM
password protect one sheet in within file DSK_7[_2_] Excel Programming 1 November 24th 04 01:23 PM


All times are GMT +1. The time now is 10:42 AM.

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"