Replace Existing File

G

Guest

I am using the following code to save the active workbook:

ActiveWorkbook.SaveAs Filename:="C:\MyWorkbooks\TempFile.xls"

How can I get it to select Yes if prompted to Replace the Existing File?
 
D

Dave Peterson

application.displayalerts = false
ActiveWorkbook.SaveAs Filename:="C:\MyWorkbooks\TempFile.xls"
application.displayalerts = true

Will save without a prompt.
 
G

Guest

Thanks Dave!

Dave Peterson said:
application.displayalerts = false
ActiveWorkbook.SaveAs Filename:="C:\MyWorkbooks\TempFile.xls"
application.displayalerts = true

Will save without a prompt.
 
G

Guest

Dave Peterson said:
application.displayalerts = false
ActiveWorkbook.SaveAs Filename:="C:\MyWorkbooks\TempFile.xls"
application.displayalerts = true

Will save without a prompt.

Hi Dave,

i am using this syntax to save activeworkbook with a new filename, but file
doesn't seem to save! Can't find it anywhere... what on earth am I doing ?

Matilda
 
D

Dave Peterson

Add one more line after the save:

msgbox activeworkbook.fullname

Maybe it'll help you notice where you saved it. Although, you should be able to
see that drive/path/name in your code (unless you changed the code).
 
G

Guest

Thanks! Can see it now!
Dave Peterson said:
Add one more line after the save:

msgbox activeworkbook.fullname

Maybe it'll help you notice where you saved it. Although, you should be able to
see that drive/path/name in your code (unless you changed the 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

Top