Hi all,
I am having constant problems with the Workbook_BeforeClose event in my workplace. Basically, the Workbook_BeforeClose doesn't allow me to do a whole host of things - Protect/Unprotect sheets, Application.DisplayAlerts = False, Thisworkbook.Save. With all of these, the code appears to run with each of them. However, none of them actually work. What I mean is that I have a piece of code that says "Worksheet("xxx").Protect Password", which runs fine, but it does not actually protect the worksheet, it remains Unprotected directly after this code runs (as I can see via the UI and subsequent bugs). The same behaviour occurs with the others.
Now I can find numerous examples, like this: http://www.vbaexpress.com/kb/getarticle.php?kb_id=379 where all the things I want should actually work. But they don't. And I am wondering why?
My workplace is using Excel 2003 (11.8169.8172) SP3. Its a very tightly controlled banking environment and as I have little actual say in hotfixes or upgrades etc its unlikely to change. My questions are:
Has anyone had similar problems? If so, was it in Excel 2003? And if you fixed it, was it because of a hotfix?
....or maybe....
Is this due to a corrupt file?
My file reads and writes from/to databases before closing, which is why I really need this event to work properly.
Thanks!
Bookmarks