Using Microsoft Access 2003 VBA Code to delete an Excel Workbook
Posted on 2011-04-27
I have a button on a form in my DB that creates an Excel Spreadsheet to display data to the end user. It saves this Excel file on the local hard drive in a specific location. After the user closes it, the data is no longer useful. Before the user runs the next instance of this, I would like Access to delete the previous Excel file before creating the new one.
The path and file name are always a constant, so they can be specified on the script. For specific reasons, I do not want the script to just overwrite the previous file the next time the user runs it. I need to have it deleted. Is there VBA Code I can add at the beginning of my script to delete the file first?