Replace an Existing File

G

Guest

I am working on an application in VBA that will read in yesterday's file,
save it as filename_OLD.xls, then replace the data in it with today's data
and save it as filename.xls. How do I replace the existing filename_OLD.xls
without having any messages or prompts appear? The VBA help tells me
everything except what I want to know. I've tried .SaveAs and doing a
..DeleteFile before saving the new version, but I've had problems with both.
 
R

Ron de Bruin

Hi Jim

If you want to overwrite the file then you can use

Application.DisplayAlerts = False
'SaveAs code
Application.DisplayAlerts = True
 
G

Guest

Thank you. Turns out that I was also trying to write to a directory to which
I had only read-access. Makes things difficult :)

Jim
 

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