ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I temporarily turn off messages in Excel (https://www.excelbanter.com/excel-programming/357381-how-do-i-temporarily-turn-off-messages-excel.html)

jtm3001

How do I temporarily turn off messages in Excel
 
How do I temporarily turn off messages in Excel, i.e. "Do you want to save
changes?". I'm running a macro that opens other workbooks and copies data to
my current file and then closes the other workbooks. I need to turn off
warning messages, and then turn them back on at the end of the macro.

sebastienm

How do I temporarily turn off messages in Excel
 
Hi,

1.
When you close the other books, use:
Workbooks("my other book").Close False
The False option explicately tells not to save, therefore no message appears.

2. For most xl messages
application.DisplayAlerts=False 'turn messaging off
'...code
application.DisplayAlerts=true
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"jtm3001" wrote:

How do I temporarily turn off messages in Excel, i.e. "Do you want to save
changes?". I'm running a macro that opens other workbooks and copies data to
my current file and then closes the other workbooks. I need to turn off
warning messages, and then turn them back on at the end of the macro.


[email protected]

How do I temporarily turn off messages in Excel
 
Application.DisplayAlerts = False

do something

Application.DisplayAlerts = True


jtm3001

How do I temporarily turn off messages in Excel
 
Thanks, the Workbook.Close False worked great in this instance, and I'm sure
I will be using the Dispaly Alerts = False/True in the future.

Thanks again!

"sebastienm" wrote:

Hi,

1.
When you close the other books, use:
Workbooks("my other book").Close False
The False option explicately tells not to save, therefore no message appears.

2. For most xl messages
application.DisplayAlerts=False 'turn messaging off
'...code
application.DisplayAlerts=true
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"jtm3001" wrote:

How do I temporarily turn off messages in Excel, i.e. "Do you want to save
changes?". I'm running a macro that opens other workbooks and copies data to
my current file and then closes the other workbooks. I need to turn off
warning messages, and then turn them back on at the end of the macro.


jtm3001

How do I temporarily turn off messages in Excel
 
Thanks!

" wrote:

Application.DisplayAlerts = False

do something

Application.DisplayAlerts = True




All times are GMT +1. The time now is 02:55 PM.

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