macro_man
04-16-2010, 09:29 AM
I have the following script to create a blank file for uploading. It must be in a text format (.txt) and must contain only one worksheet. My code attemps to delete the excess worksheets but I continue to get the warning message "Data may exist in the sheet(s) selected for deletion. To permanently delete the data, press Delete."
Another message I receive during macro execution comes from saving the file with the same name as one that already exists. The file needs to be a specific name for uploading (I always want the current one replaced). I receive the usual "The file xxx already exists. Do you want to replace the existing file?"
What code would I run to avoid the need of intervening with answers to these warning messages?
Here is the code I use for deleting the extra sheets:
'create new workbook & delete extras:
Workbooks.Add
Sheets("Sheet2").Select
With ActiveWindow
.SelectedSheets.Delete
End With
Another message I receive during macro execution comes from saving the file with the same name as one that already exists. The file needs to be a specific name for uploading (I always want the current one replaced). I receive the usual "The file xxx already exists. Do you want to replace the existing file?"
What code would I run to avoid the need of intervening with answers to these warning messages?
Here is the code I use for deleting the extra sheets:
'create new workbook & delete extras:
Workbooks.Add
Sheets("Sheet2").Select
With ActiveWindow
.SelectedSheets.Delete
End With