Tuesday, 2 October 2012

Excel VBA Macro To Delete a Desired Excel File From Directory or Folder

Excel VBA Macro To  Remove a Desired Excel File From  Directory or Folder

'Let us suppose if you want to delete a Excel File named "MyXlFile" loacated in My Documents

'You can use the KILL statement to delete a file

Sub KillMyXlFile()
Dim P As String
P = "C:\Documents and Settings\Administrator\My Documents"
Kill P & "\" & "MyXlFile.xlsx"

'You Can Specify Your Desired Path Where Your Excel File Is Located
'You Should Should Delcare Flename(Eg: MyXlFile.xlsx") with Extension

End Sub

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your open Feedback only related to this Blog Posts. Please note that I cannot respond to the Anonymous Comments.

Subscribe to Blog Posts by Email

ExcelKingdom-Popular Posts