ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Respond to Excel message box from macro (https://www.excelbanter.com/excel-programming/424773-re-respond-excel-message-box-macro.html)

FSt1

Respond to Excel message box from macro
 
hi
at the beginning of the macro....
application.displayalerts = false
then at the end of the macro..
application.displayalerts = true

or turn the built in excel alert messages off then BEFORE exiting the macro
TURN them back on. (turning back on VERY important)

look up the displayalerts property in vb help.

regards
FSt1




"JackGombola" wrote:

I open and close Excel 2003 workbooks from within an Excel 2003 Ver 11 SP3
macro. I sometimes change the files but never want to save my changes.

What statements can I inlude in my macro code to:
1. Respond "Disable Macros" to the "Security Warning" message box that pops
up when I open the file and it contains macros?

2. Respond "No" to the "Do you want to save the changes you made to ..."
message box when I close the file?

Thanks in advance for any suggestions.

John


Simon Lloyd[_1048_]

Respond to Excel message box from macro
 

You can't disable the security warning, it's there for your safety and
the user of the workbook!

As for the save warning, you could capture it with your own warning in
the before close event but if you want automatic, in the thisworkbook
module add: Private Sub Workbook_BeforeClose(Cancel As
Boolean)
ThisWorkbook.Saved = True
End Sub you can still save your work via FILESAVE ot the
Save icon.

FSt1;248516 Wrote:
hi
at the beginning of the macro....
application.displayalerts = false
then at the end of the macro..
application.displayalerts = true

or turn the built in excel alert messages off then BEFORE exiting the
macro
TURN them back on. (turning back on VERY important)

look up the displayalerts property in vb help.

regards
FSt1




"JackGombola" wrote:

I open and close Excel 2003 workbooks from within an Excel 2003 Ver

11 SP3
macro. I sometimes change the files but never want to save my

changes.

What statements can I inlude in my macro code to:
1. Respond "Disable Macros" to the "Security Warning" message box

that pops
up when I open the file and it contains macros?

2. Respond "No" to the "Do you want to save the changes you made to

..."
message box when I close the file?

Thanks in advance for any suggestions.

John



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=69347



All times are GMT +1. The time now is 01:15 PM.

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