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

1 comment:

  1. Thank You So Much.,
    Keep on following my blog...Learn More about Excel+VBA+Macros


Hi User, Thank You for Visiting My Blog. Please Post Your Feedback/Comments/Query.

Subscribe to Blog Posts by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts