Macro help anyone.....

  • Thread starter Thread starter John O'Boyle
  • Start date Start date
J

John O'Boyle

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
 
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)
 
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.
 
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)
 
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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top