Referencing Excel Sheets with JET Driver Sheets Are Duplicated with Underscores
I'm referencing an excel document with the JET database driver, which was working just fine until one day the application failed. Upon further investigation I noticed that the tabs were duplicated in some instances (all tabs actually) - i.e. Tab1$ and Tab1$_. I've researched this issue and found that it is caused by the user applying a filter. Now the filters have been remo开发者_运维知识库ved, no special formatting, frozen panes, or print formats, but still I have these tabs duplicated. Normally I'd code around this, but since we're in a code freeze I need to come up with an Excel based solution. I want to get rid of those crazy underscored tab names / reverences. I could probably run a program to clean up the file if necessary, to send it back to the users, but I want to explore Excel options first. Thoughts? I have Excel 2010, and access to any other version as well.
The underscore "sheet" is a named range. Is it possible for you to run VBA? if so:
Dim defName As Name
''Either
With ThisWorkbook ''Entire workbook
For Each defName In .Names
MsgBox defName.Name
defName.Delete
Next
End With
''Or
With Sheets("Sheet1") ''Scoped to sheet only
For Each defName In .Names
MsgBox defName.Name
defName.Delete
Next
End With
精彩评论