Marco to automatically replace existing file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a script that will preview the content of an excel file as a
".htm" file. If I make changes to the Excel, and re-run the script, it asks
to replace the existing file. Does anyone know how to have it automatically
choose yes?

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\btobin\Desktop\bt_test.htm",
FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.WebPagePreview
Application.WindowState = xlMinimized
ActiveWorkbook.Save
 
try this
Application.DisplayAlerts = False 'Put this at beginning of code
Application.DisplayAlerts = True 'Put this at the end of code
 
That did it! Thanks!

Mike said:
try this
Application.DisplayAlerts = False 'Put this at beginning of code
Application.DisplayAlerts = True 'Put this at the end of code
 

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