I have setup an automated script to run a SQL statement that will overwrite the data on a current worksheet, but I receive an error when i try to open the excel file after the automation runs. I do have VBA coded buttons on the workbook, but they are located on another sheet, and not the one I am trying to overwrite.
The error I am getting reads the following:
Excel found unreadable content in ‘NEW Template Button idea v1.02xlsm - Toad Test Form.xlsm’ Do you want to recover the contents of this workbook? If you trust the source of thsi workbook, click yes
I can then press yes and the workbook will open with the new query results populated to the workseet I specified, but the Buttons on another worksheet are gone. This is the first time I have used VBA or Toad automation.
Make sure you are not overwriting the file and only clearing the worksheet (uncheck the overwrite box in Select to File and check clear worksheet data in the advanced properties area). You may also want to keep your buttons on a different sheet than the one you are clearing each time.
I just checked my setup and I have the worksheet name pointed to the correct worksheet I need overwritten and the “Clear worksheet data before exporting” selected. I do not have the “Overwrite” option seleected. Does the destination matter if it is an “Excel file” or “Excel Instance”? I have the file option selected.
I created a xlsm file with a button on sheet2, exporting to sheet1 worked without any issue. Could you forward the xlsm file and export template used in automation ( .txp ) file to us to investigate?
Make certain you are not overwriting the file and just making the worksheet (uncheck the overwrite box in the Select to File and check clear worksheet data in the advanced properties area).