ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Selecting a response on a dialogue box from a Macro (https://www.excelbanter.com/excel-discussion-misc-queries/124625-selecting-response-dialogue-box-macro.html)

ChemicalJasper

Selecting a response on a dialogue box from a Macro
 
What is the code to select a response on a dialogue box?

I have a Macro which saves the open work book to a couple of locations
- in one of the locations it needs to be saved with the same file name
each time.

Obviously each time the macro runs, Excel opens a dialogue box asking

"Are you sure you want to Save? - this file already exists"

What code can I use to select the Yes button from the Macro?

Cheers,

Steve


RCW

Selecting a response on a dialogue box from a Macro
 
Try this.
Near the top of your macro, add the line:
Application.DisplayAlerts = False

then near the end of the macro, add the line:
Application.DisplayAlerts = True

"ChemicalJasper" wrote:

What is the code to select a response on a dialogue box?

I have a Macro which saves the open work book to a couple of locations
- in one of the locations it needs to be saved with the same file name
each time.

Obviously each time the macro runs, Excel opens a dialogue box asking

"Are you sure you want to Save? - this file already exists"

What code can I use to select the Yes button from the Macro?

Cheers,

Steve



ChemicalJasper

Selecting a response on a dialogue box from a Macro
 
Spot on! - Thanks very much!


RCW wrote:
Try this.
Near the top of your macro, add the line:
Application.DisplayAlerts = False

then near the end of the macro, add the line:
Application.DisplayAlerts = True

"ChemicalJasper" wrote:

What is the code to select a response on a dialogue box?

I have a Macro which saves the open work book to a couple of locations
- in one of the locations it needs to be saved with the same file name
each time.

Obviously each time the macro runs, Excel opens a dialogue box asking

"Are you sure you want to Save? - this file already exists"

What code can I use to select the Yes button from the Macro?

Cheers,

Steve





All times are GMT +1. The time now is 08:42 PM.

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