ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File_Save (https://www.excelbanter.com/excel-programming/307850-re-file_save.html)

Tom Ogilvy

File_Save
 
Alex has provided an excellent solution - but just to add

If the user has disabled macros when opening the workbook (or in xl2002 and
higher, security is set to high and you have not provided a certificate
accepted by the user - macros disabled silently in this case), the code
won't execute

--
Regards,
Tom Ogilvy

"Alex Guardiet" wrote in message
...
Hi,

if you place the following code in the ThisWorkbook module (go to
ToolsMacrosVisual Basic Editor and double click on ThisWorkbook in the
Project window on the upper-left-hand side):

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As

Boolean)
psw = Application.InputBox("Password:")
If psw < "hello" Then Cancel = True
End Sub

In my example the password is "hello". You can change it to whatever you

want.

Regards,

Alex

"WvR" wrote:

When the user click on File Save, I want to interrupt and ask for a

password.
Can someone please help???????





All times are GMT +1. The time now is 07:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com