Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » excel 2003 visual basic intermediate course - Deleting a file
excel 2003 visual basic intermediate course - Deleting a file
Resolved · Low Priority · Version Standard
Deleting a file
can you please tell me how i can delete a file from within excel vba?the file is a .csv file or a .cap file (this is just a file with a .cap extension and is in effect a text file). After i do all the formatting on the file and paste it into another worksheet, i need to then clear down this file by deleting it.
can anyone please tell me how?
thanks
sam
For upcoming training course dates see: Pricing & availability
RE: deleting a file
Hi SamanthaTo delete a file from the system you need to know the name of the file to be deleted. then you instruct the system to Kill the file.
NB This permanently deletes the file from the hard drive. It doesn't put it in the Recycle bin.
The code is as follows as a example
Sub DeleteAFile()
Dim WbString As String
WbString = "C:\Documents and Settings\User6\My Documents\My Sheets.csv" 'The path of the file to be deleted
Kill WbString
End Sub
Hope this helps
Carlos
RE: deleting a file
thanks for this carlos.. another question answered!!sam
|
|
» Forum post: Powerpoint Hyperlink |



Course updates

