ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro help anyone..... (https://www.excelbanter.com/excel-programming/321767-macro-help-anyone.html)

John O'Boyle

Macro help anyone.....
 
I'm new to macros, and have created them, so far, only through the
"record macro" function. My problem macro performs a "save as" and then
(supposedly) closes the sheet. When running the macro I find I need to
manually intervene twice, once for the "file exists - overwrite?"
dialog, and again for the "save changes to?" dialog. Is there a way, in
the macro, for me to respond to these queries? I responded during the
"record" but it didn't seem to take.


Thanks.

JLOB

Bob Phillips[_6_]

Macro help anyone.....
 
Try setting Application.DisplayAlerts = False before this code, it will then
just continue. Reset afterwards.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John O'Boyle" wrote in message
...
I'm new to macros, and have created them, so far, only through the
"record macro" function. My problem macro performs a "save as" and then
(supposedly) closes the sheet. When running the macro I find I need to
manually intervene twice, once for the "file exists - overwrite?"
dialog, and again for the "save changes to?" dialog. Is there a way, in
the macro, for me to respond to these queries? I responded during the
"record" but it didn't seem to take.


Thanks.

JLOB




John O'Boyle

Macro help anyone.....
 
Do you have an example of how that statement is contructed and where
that statement should go? Do I just add it to my (edited) existing macro?


thanks.

J.



Bob Phillips wrote:
Try setting Application.DisplayAlerts = False before this code, it will then
just continue. Reset afterwards.


Bob Phillips[_6_]

Macro help anyone.....
 
Sub yourMacro()

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\myDir\myBook.xls"
' rest of code
Application.DisplayAlerts = True

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John O'Boyle" wrote in message
...
Do you have an example of how that statement is contructed and where
that statement should go? Do I just add it to my (edited) existing macro?


thanks.

J.



Bob Phillips wrote:
Try setting Application.DisplayAlerts = False before this code, it will

then
just continue. Reset afterwards.




John O'Boyle

Macro help anyone.....
 
Actually, thank you, I tried it (before I saw this note) with lines #1 &
#4. Everything seems to work as advertised. Do I really need line #2?

Thanks.
JLOB


Bob Phillips wrote:
Sub yourMacro()

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\myDir\myBook.xls"
' rest of code
Application.DisplayAlerts = True

End Sub


Bob Phillips[_6_]

Macro help anyone.....
 
I put that in as I assumed you had that in your code. line #3 does say ...
rest of code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John O'Boyle" wrote in message
...
Actually, thank you, I tried it (before I saw this note) with lines #1 &
#4. Everything seems to work as advertised. Do I really need line #2?

Thanks.
JLOB


Bob Phillips wrote:
Sub yourMacro()

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\myDir\myBook.xls"
' rest of code
Application.DisplayAlerts = True

End Sub





All times are GMT +1. The time now is 09:32 AM.

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