Private Sub Workbook_Open() not firing after pc restart

dillyoh

New Member
Joined
Aug 22, 2018
Messages
12
I have a sub which loads a splash screen. very basic. For some reason the first time I load the workbook it doesnt fire. If I close it then open it it does. Then if I restart my comp and load it again it doesnt fire. Any ideas why?

Code:
Private Sub Workbook_Open()
'error 438 somewhere in here


   On Error GoTo errHandler:
Dim ws As Worksheet




Application.ScreenUpdating = False
With wbBook
 Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"
End With




For Each ws In ActiveWorkbook.Worksheets
      If InStr(ws.Name, "Dashboard") > 0 Then
          ws.Visible = xlSheetVisible
          Else: ws.Visible = False
      End If
  Next ws


With ActiveWindow
      .DisplayVerticalScrollBar = False
      .DisplayRuler = False
      .DisplayGridlines = False
      .DisplayHeadings = False
      End With
        
With ThisWorkbook
Application.DisplayFormulaBar = False
End With




Application.Visible = False
SplashScreen.Show
Application.Visible = True
Application.ScreenUpdating = True






Exit Sub
errHandler::
    MsgBox "An Error has Occurred  " & vbCrLf & "The error number is:  " _
           & Err.Number & vbCrLf & Err.Description & vbCrLf & _
           "Please notify the admin (with a screenshot of this error)"
           Err.Clear
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
A couple of things to eliminate the obvious (and I already expect these not to be an issue but....)

What is your macro security set as currently?

If you add the line in red does the msgbox appear?


Code:
Private Sub Workbook_Open()
'error 438 somewhere in here

[COLOR="#FF0000"]Msgbox "It has started!"[/COLOR]
   On Error GoTo errHandler:
Dim ws As Worksheet
 
Upvote 0
Try this, I removed your 'With' lines.

Code:
Private Sub Workbook_Open()
'error 438 somewhere in here

On Error GoTo errHandler:
Dim ws As Worksheet

Application.ScreenUpdating = False

Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"

For Each ws In ActiveWorkbook.Worksheets
      If InStr(ws.Name, "Dashboard") > 0 Then
          ws.Visible = xlSheetVisible
          Else: ws.Visible = False
      End If
Next ws

With ActiveWindow
      .DisplayVerticalScrollBar = False
      .DisplayRuler = False
      .DisplayGridlines = False
      .DisplayHeadings = False
End With
        
Application.DisplayFormulaBar = False

Application.Visible = False
SplashScreen.Show
Application.Visible = True
Application.ScreenUpdating = True

Exit Sub
errHandler::
    MsgBox "An Error has Occurred  " & vbCrLf & "The error number is:  " _
           & Err.Number & vbCrLf & Err.Description & vbCrLf & _
           "Please notify the admin (with a screenshot of this error)"
           Err.Clear
End Sub
 
Upvote 0
hey thanks for your prompt reply.
I've tried the msg box idea and sometimes it fires and sometimes it doesnt. It did come up with an error 438 at one point, I made some changes and I'm not sure what fixed it but it seems to have gone away.

I'm self taught so as far as the macro settings which ones/where?
 
Upvote 0
because the issue is with the on open event would that mean the rest of my code cant be to blame? I've gone through my other modules and forms and I cant find anything that would interfere with this event but I guess none of it can be to blame anyway because its all run when its called upon rather then automatically. is that right?
 
Upvote 0
self taught so as far as the macro settings which ones/where?
Developer tab - Macro Security (should default to Macro settings), then what is checked?

Btw, I can't see why the removal of the With statement would make any difference as nothing in the next line is referring to the With statement.
 
Last edited:
Upvote 0
is it possible for the enableevents to hide this function? where is that param stored, can I see it somewhere? if I disabled that feature somewhere in my code by accident and then saved the workbook does it get stored for next time I open it?
 
Upvote 0
I made a whole new workbook with just the start up sub. Sometimes it fires sometimes it doesn’t. So not my coding or settings. Not sure why??
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
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