View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Linking to specific cells in pivot table Linking to specific cells in pivot table is offline
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