PDA

View Full Version : VBE opens by itself



K. Georgiadis
09-15-2007, 06:10 AM
Hi folks!

I believe that I saw something about this a long time ago but I can't seem to locate it.

I have a workbook (Excel 2002) that contains VBA code. When the workbook is open and the PC has been idle for a while, I return to find that, all by itself, Excel has opened and is displaying the Visual Basic Editor window. I don't want to hand the workbook over to the ultimate user with this glitch because it will confuse the heck out of them.

Any ideas what is causing this and how to prevent it?

lucas
09-15-2007, 06:32 AM
What code do you have in the thisworkbook module?

K. Georgiadis
09-15-2007, 06:39 AM
Thanks for the prompt reaction Lucas. ThisWorkbook contains:


Private Sub Workbook_Open()
Sheets("Control Panel").Select
Range("A1").Select
End Sub


So that the workbook always opens at my "Control Panel."

lucas
09-15-2007, 06:49 AM
I don't see anything there that might be a problem, as long as there is a sheet with that name.

When the vbe opens does it hightlight a line as an error is occuring....are you using option explicit?

K. Georgiadis
09-15-2007, 07:02 AM
No error of any kind; it just diplays the VB Editor window. There are a few macro modules in the workbook that include "option explicit," but as I said there are no macro errors; they all work predictably.

I believe I saw an unusual solution for this in Microsoft Communities that went something like this: after using the VBE, close it and then save the workbook. Re-open the file but don't open VBE; save again. Close and re-open. Something of the sort but I am not sure.

lucas
09-15-2007, 07:07 AM
You should use Option explicit in all of your modules.

Here is a link to your first post on this issue:
http://www.vbaexpress.com/forum/showthread.php?t=12582&highlight=Visual+Basic+Editor

daniel_d_n_r
09-17-2007, 04:30 AM
when this sort of thing happens i usually delete the sub save workbook,
open it again and write/paste another(rename if possible).
I had a similar problem that when i ran an AUTO_OPEN sub it opened then cut straight to the VBE.

sorry i don't have any technical solutions.
Just watch your naming and your globals , ect and design/debugg mode.

cheers