Delete File in current folder

account123

New Member
Joined
Oct 1, 2016
Messages
11
Hi everyone,

Iam trying to write a small code using the KILL Command to delete a file called "Monthly Summary.xlsm" from the current folder.

Thank you
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

RMS123

Board Regular
Joined
Jun 1, 2016
Messages
62
Something like this?

Code:
Sub deletefile()


Dim Killfile, filepath, filename As String


'enterfilepath
filepath = ""


filename = "Monthly Summary.xlsm"


Killfile = filepath & "\" & filename


If Len(Dir(Killfile)) > 0 Then


    Kill (Killfile)


End If




End Sub
Regards
 

Watch MrExcel Video

Forum statistics

Threads
1,089,992
Messages
5,411,712
Members
403,392
Latest member
Faster 72

This Week's Hot Topics

Top