Hi All.
I would like to avoid user to SAVE or SAVE AS file. In my macro I used code to disable SAVE and SAVE AS from FILE menu. But how to avoid to save file if user use CTRL+S command to save file?
Thanks.
Hi All.
I would like to avoid user to SAVE or SAVE AS file. In my macro I used code to disable SAVE and SAVE AS from FILE menu. But how to avoid to save file if user use CTRL+S command to save file?
Thanks.
Last edited by eugz; 04-30-2009 at 12:18 PM.
In "ThisWorksheet" use the following code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Cancel = True End Sub
Rule 1: Never merge cells
Rule 2: See rule 1
"Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".
You might add
to that so the user doesn't keep getting prompted to save on exit.Me.Saved = True
And as a courtesy, also add something to tell the user what's going on:
MsgBox "No saving allowed!"
Entia non sunt multiplicanda sine necessitate
Thanks Dave. It is works. But I'm thinking user will confused when will try close file and get message: "Do you want to save the changes you made "filename.xls"?" User try to click YES button and message will on screen. How to avoid save file and avoid pop up message also?
Thanks.
You'll need to incorperate
into your code to avoid the warning when closing.Application.DisplayAlerts = False
I insert this code to ThisWorkbookBut message still pop up. What I did wrong?Private Sub Workbook_Close() Application.DisplayAlerts = False End Sub
Thanks.
There is no Close event
Private Sub Workbook_BeforeClose(Cancel As Boolean) Me.Saved = True End Sub
Thanks a lot everyone. It is exactly what I want to do.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks