There are a couple spots in the workbook I built where I want to delete one or more tabs. The first scenario I used was an extremely complicated one where the delete command occurred at the end of a large amount of code, so I assumed that was the reason Excel got confused and crashed.
However, I am also seeing this in a much simpler scenario. Essentially I have two tabs in my workbook which are used for demo purposes only (to introduce the workbook functionality). When I'm done, I want to click a button that says "End Demo" which will then delete the two demo tabs. I have researched this extensively and tried implementing some of the solutions I've discovered, but none have helped. Here is the code the button calls:
I cut the button that called the code so it didn't get hung up on trying to call that object on a deleted tab. I introduced a brief wait to allow the system to catch up. And I activated a different workbook tab so it wasn't deleting the active sheet. Still I get the crash more often than not. What else can I try to allow these tabs to delete without crashing?Please Login or Register to view this content.
Bookmarks