VBA Delete the Workbook
Generally, to delete the workbook you can simply click on the file, and press the delete tab on the keyboard, or Right-click on the file and click on the delete button.
But if you want to delete the file by using VBA coding, you must know the location of the file.
Let’s see, how to delete the workbook using VBA code…
When you write the code for delete the file make sure that the file is closed if the file is not closed, you will get a pop-up message of error.
Also, if the file does not exist at the same location, you will get the error message as below.
Related: Excel VBA common basic questions
Related: How to Record, Run and Save Macro
Written by: Kalpesh Agrawal (Actuarial Intern - IIB)