MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Disable a macro of Excel


Posted by Birtz on September 21, 1999 11:52 PM

Please, explain to me the following problem. When I close Excel, I would to write a macro wich does not display the window "Save the change ? Yes,No,Cancel". Put into a netshell, would like that the program must not require to save when I close Excel


Thanks

Birtz


Posted by Ivan Moala on September 22, 1999 2:28 AM

Assuming Excel'97
Add this to your worksheet macro in the
correct place/section
ie. Under VBA project <FileName>
Microsoft Excel Objects
Thisworkbook

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub


regards

Ivan

Posted by Birtz on September 23, 1999 1:26 AM

Thanks to Ivan Moala for the solution.
I have another problem: when I open an Excel document, Excel display the window "The doocument contins macro.....virus....". Can I disable the open of that window ?

Thanks

Birtz

Posted by Ivan Moala on September 23, 1999 4:03 AM

Birtz

Birtz
No you can't disable this ??, or at least I don't
think you can, no doubt someone will come up with
a way BUT......if you put the file into the xlstart
directory it will automatically load in everytime
you start excel WITHOUT prompting you with the macro splash screen. This directory is assumed to be a safe directory for your excel files and is usually in;
C:\Program Files\Microsoft Office\Office\XLSTART

Regards

Ivan