Tuesday, October 2, 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

Thanks,Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. If you wish, please share your genuine Feedback or comments only related to this Blog Posts. It is my humble request that, please do not post any Spam comments or Advertising kind of comments, which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose we have a sample Sales data, which is stored with Monthly Snapsh...

Popular Posts from this Blog