Worbook open event not triggering?

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,616
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
This should be pretty basic, but my code below doesn't seem to be triggering.
This code is in the ThisWorkbook object of the workbook opened.


Rich (BB code):
Private Sub Workbook_Open()
   
    Set wb_dia = Workbooks("Diamond_Test.xlsm")
    Set ws_template = wb_dia.Worksheets("template")
    Set ws_lists = wb_dia.Worksheets("lists")
    Set ws_front = wb_dia.Worksheets("front")
    Set rngTemp = ws_template.Range("B1:AB44")
    Set rngSvc = ws_lists.Range("A2:C59")
    Set rngFac = ws_lists.Range("E1:E" & ws_lists.Cells(ws_lists.Rows.Count, "E").End(xlUp).Row)
    Set rngFac3 = ws_lists.Range("E1:G" & ws_lists.Cells(ws_lists.Rows.Count, "E").End(xlUp).Row)
   
    svcCnt = 0
    svcRid = 0
    mbevents = True
   
    Stop
    With ws_front
        .Activate
        ActiveWindow.ScrollRow = 1
        ActiveWindow.ScrollColumn = 1
        .Unprotect
        With ws_front.Range("J3:BM1102")
            .Clear
            For Each shp In .Parent.Shapes
                If Not Intersect(shp.TopLeftCell, .Cells) Is Nothing Then shp.Delete
            Next shp
        End With
        mbevents = False
        .Range("A1") = "Enter Date"
        .Range("A2") = Format(0, "00000") 'date serial
        .Range("D2") = Format(0, "000") 'record
        .Range("E2:F2").Locked = True
        .Range("E2") = svcRid
        .Range("G2") = svcCnt
        mbevents = True
        .Protect
    End With
   
End Sub

I have a stop command in this code, but when I open the workbook, this line isn't reached. If the code was triggered, it should stop with this command.

The other weird thing, a relatively small workbook takes a noticeably long time to open (in terms of milliseconds). I have much larger workbooks that open seemingly instantly.

Thoughts?
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Seems to only fail when another particular workbook is open. The other workbook has no vba so it'
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
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