Output to xls and overwrite

G

Guest

Is it possible to use the "output to" command in a macro and have it
automatically overwrite the existing file instead of asking if it's ok to
overwrite? Thanks.
 
D

Douglas J. Steele

I never use macros, so I'm not sure whether it's possible, but see whether
you can check if the file exists (use the Dir function, and delete it if it
does.

It would be pretty simple to do this in VBA:

strFile = "C:\...\file.xls"
If Dir(strFile) > 0 Then
Kill strFile
End If
 

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