Delete file after import from directory c:\abc.txt

  • Thread starter Thread starter Vince
  • Start date Start date
V

Vince

Hi,

Does anyone have a code for my button on click to run a
macro that deletes abc.txt file?

Please and thank you,

Newbie..

Vince
 
Vince said:
Hi,

Does anyone have a code for my button on click to run a
macro that deletes abc.txt file?

Please and thank you,

Newbie..

Vince

I may be wrong, but I don't think you can delete a file using a macro
alone. I think you have to use VBA to do it. The VBA code would be

Kill "c:\abc.txt"

So you could set your button's OnClick property to "[Event Procedure]"
and create this procedure (named as if your button were named
"Command1":

Private Sub Command1_Click()

Kill "c:\abc.txt"

End Sub

If your button has to do something else, finishing up with deleting the
file, then the best way to do it would be to write the whole process as
a VBA procedure, rather than using the very limited macro language. Let
me know if you need help with this.
 
Dirk is correct. You cannot delete a file directly by a macro action. You
must use VBA.

--
Ken Snell
<MS ACCESS MVP>

Dirk Goldgar said:
Vince said:
Hi,

Does anyone have a code for my button on click to run a
macro that deletes abc.txt file?

Please and thank you,

Newbie..

Vince

I may be wrong, but I don't think you can delete a file using a macro
alone. I think you have to use VBA to do it. The VBA code would be

Kill "c:\abc.txt"

So you could set your button's OnClick property to "[Event Procedure]"
and create this procedure (named as if your button were named
"Command1":

Private Sub Command1_Click()

Kill "c:\abc.txt"

End Sub

If your button has to do something else, finishing up with deleting the
file, then the best way to do it would be to write the whole process as
a VBA procedure, rather than using the very limited macro language. Let
me know if you need help with this.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top