suppressing message boxes


Posted by bill mahoney on April 02, 2001 3:09 PM

I am running a series of macros that take certain portions of multiple workbooks and pastes them into a csv file. But as each workbook is closed and when I save the csv file I get message boxes asking if I want to save changes. Is there a way to stop these message boxes from appearing. It would save loads of time and eliminate the need for user intervention.

Thanks in advance for the help.

Bill Mahoney

Posted by Dave Hawley on April 02, 2001 3:21 PM


Hi Bill

Basically all you need to do is trick Excel into thinking the workbooks are already saved. It depends on how you are referencing your Workbooks, but one of the codes below should suit.

Sub TryOneofThese()
ActiveWorkbook.Saved = True
ThisWorkbook.Saved = True
Workbooks(StringVariable).Saved = True
Workbooks(1).Saved = True
End Sub

Dave

OzGrid Business Applications

Posted by Jacob Hilderbrand on April 02, 2001 5:34 PM

Just turn off all alerts while the macro is running

All you have to do is put this code at the begging of you macro:

application.displayalerts=false

This will turn off all the alerts like "do you want to save" while the macro is running.

Hope this helps.

Jacob

Posted by Dave Hawley on April 03, 2001 1:20 AM

Re: Just turn off all alerts while the macro is running

application.displayalerts=false This will turn off all the alerts like "do you want to save" while the macro is running. Hope this helps. Jacob

Jacob, I'm assuming that Bill doesn't want to save the Workbooks as he is only taking data from them and not putting data in.

But yes, if Bill does want to save each workbook, then DisplayAlerts=False will cause a save without asking.


Dave

OzGrid Business Applications



Posted by Dave Hawley on April 03, 2001 1:23 AM

Oops , I have that back to front :o)

OzGrid Business Applications