I am currently using a procedure that uses a blank Excel file to
write to. The file is an intermediate step used for a short while and
saved under a different name after it is written to. I have run into
a problem where people will delete the file from the folder and the
procedure fails when it can't find the file to open. The file is
used to hold a copy of a page from an existing file. I can easily use
the copy function, but need to go back to the file I created and
rename it later on. The name I will use to save the file with is not
available at the time I copy the data to it. I need to know the name
of the "blank" file so I can reopen it and save it under the
appropriate name. I don't necessarily know the name if I merely copy
the data to a new file since it could be book1, 2, etc. If I just
create a new file with the copied information in it I can rename the
file, but that leaves the file in place all the time with the
resulting possibility of someone deleting the file and making the
procedure fail.
How can I delete a file in a folder through VBA so it doesn't give a
warning that the file already exists when I try useing that same name
again? I have tried using the recorder and get no results when I
delete the file. I am using version 2001 of Excel.