In this article we are going to show you how you can delete file or files using a single line of VBA code.
Kill "E:\Work\ExcelSirJi\ Test 3.txt"
For example, you may want to delete all .txt files from the folder and do not want to delete any other types of files.
Kill "E:\Work\ExcelSirJi\*.txt"
Kill "E:\Work\ExcelSirJi\*"
The code will delete file(s) from the given folder
Thanks for reading the article, subscribe us to get more VBA tricks
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
VBA Code to Filter Data in Excel Here is an easy reference code which filters data in the sheet. In the code, we have filtered the data in three steps. Step 1:Â Remove existing filter from…
Have you ever felt that Microsoft should have added a formula in Excel which can count the cells based on specific color? I have seen many code requests to share a VBA code that can count the cells by its color. To help our subscribers and developers, we are sharing 2 codes that be used to count the cells with specific color and returns the count of the matching color cells.
VBA Code to Sort Data HERE IS A ONE LINE CODE FOR DEVELOPER’S REFERENCE WHICH CAN BE USED TO SORT DATA ‘Sort data in ascending order on Column F (Created At) Sheet1.Range(“A1:G” & Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Row).Sort Key1:=Sheet1.Range(“F1”),…
VBA Code to Count Color Cells With Conditional Formatting Have you ever got into situation in office where you need to count the cells with specific color in conditional formatted Excel sheet? If yes then…
To ensure that your VBA project works smoothly without any error, you need to put lot of error handlers and validations. Here is one of them, below code can be used to check if the given path is valid or not. You just need to provide the path of the file to the function and it will check if the file exist at the location. If it returns True that means the file is available at the path, if it returns False that means it is invalid path or the file does not exist at the location.
Did you come across any requirement where you want the user to interact with a sheet only through VBA Form? Here is a simple code which can help you here.
Could you kindly please send the VBA code how to deleteor files using a single line of VBA code my email address [email protected]
Just want to check, are you not able to copy the codes from the article. You can use these same codes for your requirements. Let us know if you have any other challenges.