Starting with a version 2003 .XLS template file containing multiple sheets having autofilter enabled
populate data into multiple sheets
remove unused sheets from workbook using Worksheets.RemoveAt(“Pending Jobs”)
save as version2003 using Save(FileName, FileFormatType.Excel2003)
Code completes and saves .XLS file without error. An error occurs when opening the workbook in Excel 2007 that had a sheet removed.
“Naming Conflict” error message pop-up from Excel 2007 forces user to rename “_FilterDatabase” to something else. “_FilterDatabase” appears to be the name of the range of autofiltered cells in the resulting workbook. But this name is not used in the source template workbook.
The .XLS workbook with removed sheet(s) may be opened in Excel 2003 without issue.
If I save as a .XLSX workbook (FileFormatType.Excel2007Xlsx) there is no error opening in Excel 2007 with the removed sheets.
Is there another method I should be using to remove these sheets?