Workbook_Open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The code in ThisWorkbook.Workbook_Open is not getting executed when the
workbook is opened. I put a Msgbox right at the top of the code and I never
see it.

InTHANKSAdvance
 
Hi
you have to put this code in your workbook module ('ThisWorkbook')
 
Hi Jim,

One possibility is that EnableEvents has been set to false, perhaps by
interrrupted code operation.

In case this is the reason, run:

Sub Test()
Application.EnableEvents = True
End Sub
 
I do manipulate EnableEvents.
Does this persist between invocations of Excel?
 
Hi Jim,
Does this persist between invocations of Excel?

No, Events are enabled by default each time Excel is opened. So if your
Workbook_Open code is not firing after closing and re-opening Excel, my
guess was wrong. If, howver, Events are set to false and the workbook is
re-opened, the event code would not fire.

As Frank suggested, post your code. If the code is in the correct module
(ThisWorkbook) and events are set to true, the only remaining factor that I
can think of is the code itself.
 
Hi Jim,

One other thought, how are you opening the workbook?
 
And to piggyback on Norman's leading question...

If you're opening the workbook via a macro and use a shortcut key that includes
the Shift key, remove the shiftkey from the shortcut key combo.

Holding the Shiftkey down when you're opening a workbook stops the auto_open and
workbook_open code from running. And excel gets confused about your shiftkey in
the shortcut key combination.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top