

MsgBox "File has deleted : " & vbCrLf & sPath, vbInformation, "VBA Kill Function" SPath = "C:\VBAF1\VBA Functions\VBA Text Functions\Temp.xlsx" Here is a simple example of the VBA Kill function. Output: Here is the screen shot of the first example output.Įxample 2: Delete a File(Returns an Error) MsgBox "File Deleted Successfully : " & vbCrLf & sPath, vbInformation, "VBA Kill Function" SPath = "C:\Someswari\VBAF1\VBA Functions\VBA Text Functions\Temp.xlsm" This below example deletes a file and displays message. We can use this Kill Function in VBA MS Office 365, MS Excel 2016, MS Excel 2013, 2011, Excel 2010, Excel 2007, Excel 2003, Excel 2016 for Mac, Excel 2011 for Mac, Excel Online, Excel for iPhone, Excel for iPad, Excel for Android tablets and Excel for Android Mobiles. Where we can apply or use VBA Kill Function? Wild Card CharacterĪllows you to match any string of any length (including zero length)Īllows you to match on a single character It contains wild card characters either *(multiple characters) and ? (single Character). The PathName argument represents the path of a file, folder, or directory. PathName:It is a mandatory string type parameter. The Kill function has one argument in Excel VBA. If pathname doesn’t include a folder name, the specified file considers current folder. The Pathname argument represents the file path name. The Kill Function returns doesn’t return any file. The syntax of the Kill Function in VBA is Kill(PathName)

Example 3: Delete all Files using Wild card Character(* and ?).Example 2: Delete a File(Returns an Error).Where we can apply or use VBA Kill Function?.
