Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete a file outside the database thru a macro

Status
Not open for further replies.

Michael57

Technical User
Nov 15, 2005
131
0
0
CA
I would like to use a macro to delete a file in a directory outside of the access database im using. Can anyone give me the item I should put in my macro?
 
In VBA you may use the Kill instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If the file is c:\directory\file.txt how would I write the VBA to delete this file?
 
If Dir("c:\directory\file.txt") <> "" Then Kill "c:\directory\file.txt"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I am looking for this same answer. How does one run that VBA code from a macro? I am using OutputTo commands from a macro. If called from the Switchboard Manager (Menu) it does not ask to replace the file, just does, but if called from anything else, it asks to replace the existing file. I can't find the command in the Switchboard VBA code that "kills" the file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top