How do I delete a file in a folder from WITHIN ACCESS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am Exporting a File to Excel over and over with the same name. However
everytime I need to Delete the file to be able to exported again. Is there a
function or A Macro command within Access that allows me to delete the Excel
file prior to doing tthe Export?
I am using Access 2003
Thanks...
 
HKHELOU said:
I am Exporting a File to Excel over and over with the same name.
However everytime I need to Delete the file to be able to exported
again. Is there a function or A Macro command within Access that
allows me to delete the Excel file prior to doing tthe Export?
I am using Access 2003
Thanks...

Kill "Path to File"
 
I do the same thing. I don't know if this will help, but I check if the file
name exists, then re-save it. Here is the code (part of my function in the
Module section) I use:

If Dir(outputname) <> "" Then SetAttr outputname, vbNormal
DoCmd.OutputTo acQuery, Name, "MicrosoftExcelBiff8(*.xls)", outputname,
False, "", 0
SetAttr outputname, vbReadOnly

** outputname is my variable for the full file name and path. **

Adam.
 
Back
Top