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
Correctly.

End Sub

2 comments:

  1. Very Nice.....Blog

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

    ReplyDelete

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts