ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Having a macro interact with a dialog box. (https://www.excelbanter.com/excel-programming/282921-having-macro-interact-dialog-box.html)

Louis[_2_]

Having a macro interact with a dialog box.
 
I have a macro that creates a worksheet in a workbook.
Imports data in it formats it, prints it, and then the
macro deletes the worksheet.

When I run the macro evrything is done perfectly except
that I have to interact when a dialog box confirming the
deletion of the worksheet pops up.

Is there some code that would let the macro answer "OK" to
the dialog box so that it could run unattended?

My code is as follows:

ActiveWindow.SelectedSheets.PrintOut Copies:=1
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
'Dialog box appears here
Range("A6").Select
End Sub

Thanks in advance

Anders S[_2_]

Having a macro interact with a dialog box.
 
Louis,

Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete

HTH
Anders Silvén

"Louis" skrev i meddelandet ...
I have a macro that creates a worksheet in a workbook.
Imports data in it formats it, prints it, and then the
macro deletes the worksheet.

When I run the macro evrything is done perfectly except
that I have to interact when a dialog box confirming the
deletion of the worksheet pops up.

Is there some code that would let the macro answer "OK" to
the dialog box so that it could run unattended?

My code is as follows:

ActiveWindow.SelectedSheets.PrintOut Copies:=1
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
'Dialog box appears here
Range("A6").Select
End Sub

Thanks in advance


Louiis

Having a macro interact with a dialog box.
 
I'll try tha

Thanks


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

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