Workbook_Open not running when opening a workbook

JasonNH

New Member
Joined
Jul 6, 2022
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hello,

Workbook_Open() is not working anymore. I removed a class module from PERSONAL.XLSB which had only one line:
VBA Code:
Option Explicit
and then some commented code. This was related to an old macro which was not in use. Reverting this makes no change.

I searched for forums and made sure that
  1. I have macros enabled
  2. Exact phrase to call Workbook_Open is:
    VBA Code:
    Private Sub Workbook_Open()
  3. Workbook_Open() is called in ThisWorkbook object

Other macros run normally as before, this just does not fire up on opening workbooks anymore.
I tried repairing Office without changes to data. Next step would be to Reset, losing data, which I try to avoid. Are there any other fixes to try?
 
Are you sure it is not running?
What does the code inside this "Workbook_Open" event actually look like (you haven't posted it yet)?

Depending on what your code is doing, perhaps it actually is running, but just failing to meet some criteria you have set, so nothing is happening.

Try placing a Message Box as the very first line of the code, and see if you get anything when you open the file, i.e.
Rich (BB code):
Private Sub Workbook_Open()
    MsgBox "Workbook_Open code is running"

   ...
End Sub

If you get that Message Box pop-up when you open the file, then you know that there is nothing wrong with the "Workbook_Open" call or code placement, and the fault lies within the logic of your code.
That's exactly how I'm testing it. There's only one line in Workbook_Open()
VBA Code:
    MsgBox ("ok")
Message box pops up when I start Excel, from shortcut, i.e. not opening a workbook to start Excel.
It does not pop up when I open a workbook.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
That's exactly how I'm testing it. There's only one line in Workbook_Open()
VBA Code:
    MsgBox ("ok")
Message box pops up when I start Excel, from shortcut, i.e. not opening a workbook to start Excel.
It does not pop up when I open a workbook.
How/where exactly are you opening this workbook?
Are you opening it from inside Excel?
From Windows Explorer?
From an email?
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Workbook_Open() not working anymore
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
So it's the Open event in Personal.xlsb that isn't working? Does the open event in other workbooks work?
 
Upvote 0

Forum statistics

Threads
1,215,467
Messages
6,124,984
Members
449,201
Latest member
Lunzwe73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top