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?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Run the below in Immediate window and hope then the code under Workbook_Open() will work
Application.EnableEvents = True
 
Upvote 0
Run the below in Immediate window and hope then the code under Workbook_Open() will work
Application.EnableEvents = True
Hello Sanjeev, Thanks for answering.
I tried this but it did not change a thing. Should there be some kind of notification in Immediate window after running this? I got nothing.
Stupid question: Is it enough to press Enter in Immediate window or is there something else?
 
Upvote 0
?Application.EnableEvents If you get TRUE in the immediate window, it means events are enabled.
 
Upvote 0
The result is True. But WorkBook_Open() still not running,.
 
Upvote 0
Hi,
From another point of view...Have you checked the settings of Protected View in the Trust Center? I've heard of the Protected View does mischievous behavior to the Open event in some cases. (Not in all the situation)
 
Upvote 0
Thanks for your suggestion. I tried different Protected View settings with no result.

Now I've done these with no result:
• Digitally signed the macros in workbook
• Tested Excel's every setting for Macro security
• Tested with a new workbook, both .xlsx and xlsb
• Tested different settings of Protected View
• Added OneDrive and a network folder as Trusted locations
• Opened workbook from local hdd, not network or OneDrive¨
• Ran Excel as administrator
• Tried a 2 week old backup of PERSONAL.XLSB
• Tried to remove all add-ins, DAX studio stays
• Uninstalled DAX-Studio
• Used Windows Apps & Features 'Reset' function for Office
• Unistalled Office
• Reinstalled Office - My ribbon customizations remained as well as recent and pinned workbooks. Apparently uninstall does not remove every bit of Office.

When I start Excel, from shortcut, WorkbookOpen() is triggered. Meaning, when PERSONAL.XLSB is opened the macro runs. But it's not running when I open a Workbook, by any method, double-clicking in explorer or File → Open from Excel itself.

Starting to be desperate here. Thougth reinstall at least would fix it but no.
Any ideas anyone?
 
Last edited:
Upvote 0
Does the Open event work if you run Excel in Safe mode? (hold down the Ctrl key while starting Excel)
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

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