Originally Posted by xld
Not quite.
1, When a sheet is deactivated, it's codename is sent to the public function.
2. Public function takes that codename and finds its current Excel name.
3. Public function sends Excel name back to the Deactivate event.
4. Deactivate event fires a timed macro, to act in one sec - this is to enable Deactivate to complete and ensure the sheet is deleted.
5. DeleteSheet checks if the name passed exists or not, and says so if not. Remember this gets called on any deactivate, so we have to test that it doesn't exist to identify deleted sheets.
It works on the principle that when you delete a worksheet, the daectivate is called before it is deleted. So you can still get details about it before it disappears into the ether, but you can't test anything as it still exists, hence OnTime.
.