Workbook_Open not running when workbook opens

mwollert

New Member
Joined
Jul 13, 2020
Messages
27
Office Version
  1. 365
Platform
  1. Windows
I have a workbook that I have been using for years. Suddnely yesturday the Workbook_Open in ThisWorkbook no longer runs when the workbook opens. Once the workbook opens I can run the the Workbook_Open routine and all others macros. I have check that Application.EnableEvents is set tot True. I have ensured that macros are enabled. I have replaced the Workbook_Open with a simple MsgBox and it still will not execute at open.

I have gone back to the last time the Workbook_Open functioned properly (the macro creates a copy of the file) but it will not trigger.

I have created new workbooks and the Open routine works fine. I have even copy and pasted the problem WOrkbook_Open to a new workbok and it functions as designed.

I am at a loss as to why this particular file not longer triggers the macro.

Any suggestions are welcome.
 
Can you remove all data (but leave the code and formatting) and post the workbook somewhere (eg OneDrive/deopbox) for us to have a look at?
I was going to try that, but there are about 30 sheets of information and removing it was going to take a bunch of time and create a bunch of errors most likely.

My work around has been to utilaize the Workbook_BeforecClose macro. I created a new Worksheet that has no data and just text that workbook is opening. In the Workbook_BeforeClose macro I make the the new worksheet the active sheet. SInce the Workbook_Open macro has instructions to make the first worksheet the active worksheet, if that new worksheet remains active, then I know the Workbook_Open macro did not trigger. Since the only option at that is is to select a worksheet, I use the Workbook_SheetActivate to call Workbook_Open. I also added a golbal boolean variable and set it to true when Workbook_Open runs. I then check in the Workbook_SheetActivate if Workbook_Open has already run and if so, it does not call it again. I have not noticed any performace issues with this work around.

VBA Code:
Private wbOpenEventRun As Boolean

Private Sub Workbook_Open()
      wbOpenEventRun = True
      'Rest of Routine
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
  
    If Not wbOpenEventRun Then
          Workbook_Open
    End If
    
End Sub


I found the solutiion form another thread on this site, but can't find it again to share to with everyone as a easy get around to Workbook_open not triggering. I'll keep looking for the link and post it if I find it.

Surprizingly enough the Workbook_Open started triggering again this weekend. About 10 open/closes and it triggered everytime!! I though perhaps there was an update or something the fixed the glitch. Then just to knock me down again it started to not trigger this afternoon but the work around is working just fine.

Thanks for all the suggestions. I will report back if I figure out what is causing the issue randomly.
 
Last edited:
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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