#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rufusf
 
Posts: n/a
Default closing & saving


Hi

is there anyway i can set up a workbook so that it automaically saves
when you close it (every time)?

also, can i password protect closing a workbook so that you need to put
a password in to close the file?

thanks

rufusf


--
rufusf
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
vezerid
 
Posts: n/a
Default closing & saving

The following event procedure will prompt for a password. If the
password is correct, it will save the file and then close. Else it will
cancel the closing process.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
myStr = InputBox("Password required for closing")
If myStr = "my set password" Then
Me.Save
Else
Cancel = True
End If
End Sub

To install:
Alt+F11 to go to the VBA IDE
In the Project Explorer (top-left subwindow) double-click the
ThisWorkbook icon.
In the code page that appears paste the code above.

HTH
Kostis Vezerides

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rufusf
 
Posts: n/a
Default closing & saving


thank you very much - I will give this a try


--
rufusf
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
Is there any way to recover changes after closing w/o saving? John Excel Discussion (Misc queries) 1 January 16th 06 03:02 PM
Saving worksheet as webpage Aramis Excel Discussion (Misc queries) 1 January 9th 06 10:26 PM
Closing Excel without saving Abs Excel Discussion (Misc queries) 9 December 7th 05 03:10 PM
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM
Closing Excel Chad Excel Discussion (Misc queries) 2 March 18th 05 03:57 PM


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