Disable File-Save menu item in macro?

B

BrianG

I've created a form which uses a macro in Excel97. The working form
resides in the local drives \temp folder. I've created a button on the
form which is used to permanently save the finished form to the server
and delete the temp file. I also have an AutoClose macro that displays
a warning dialog if an attempt is made to close the form without saving
it to the server. The problem is that a couple of users tend to do a
File-Save from the pull down menu which only saves the local temp file.
When then they try to close the form they get the "file not saved
correctly" error message. I'm really getting tired of being paged
because their file "didn't save". Anyone have any ideas on how to solve
this problem? Is there a way to control or disable the File-Save menu
item from within a macro?

BrianG


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
J

JE McGimpsey

one way:

Put this in your ThisWorkbook code module:

Private Sub Workbook_BeforeSave( _
ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
MySaveRoutine
End Sub

Where MySaveRoutine is your code to properly save the workbook.
 
B

BrianG

Thanks. I use the ActiveWorkbook.SaveAs method to save the file to the
server and discovered that the BeforeSave event is triggered by this
method. Is temporarily disabling events using the
Application.EnableEvent property the best way of dealing with this?



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top