output to action file overwrite

J

jcao123

I have a macro with an "output to" action to send the data to an .xls file. I
have a file path and name in the "ouput file" parameter. I scheduled this
macro to run in the scheduler. Works well except when I accidently already
have a file of the same name in the folder and the scheduled run at night is
waiting for me to hit the 'yes' or 'no' button to over write the file. Is
there a switch or an option I can set up in the macro to always overwrite if
found a file with the same name in the folder already?
 
D

Douglas J. Steele

You need to check whether or not the file already exists, and delete it if
it does.

To check whether a file exists, you can use the Dir function around its
name: Dir will return a non zero-length string if the file exists.
 

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