"Error, restart your workbook" on open from another workbook.

JLouis

Active Member
Joined
Jan 1, 2004
Messages
295
Office Version
  1. 365
Platform
  1. Windows
Hello. Some of you may recognize this error. It is part of the custom ribbon code.

Sub RefreshRibbon(Tag As String)

MyTag = Tag
If Rib Is Nothing Then
MsgBox "Error, restart your workbook"
Else
Rib.Invalidate

End If
End Sub
'Note: Do not change the code above

I have a different workbook that opens this one and it throws this code when first opened. Cancel the error and the WB works fine without error. I think the error comes from the first worksheet that does not contain a custom ribbon code called "Home." I've tried several combinations of ribbon code that doesn't solve the problem. The "Home" worksheet does not have a custom ribbon.

This is the code to open the workbooks:
Workbooks.Open (CurDir & "\4 LELAND\NBO 1829 Schedule\1829 Scheduling Program.xlsm")
Workbooks.Open (CurDir & "\2 oleander\NBO 276 Schedule\276 Scheduling Program.xlsm")

This is part of the ribbon code in the "Private Sub Workbook_SheetActivate(ByVal Sh As Object)"

Case "Home": Call RefreshRibbon(Tag:="Home")
'Case "Home": Exit Sub (commented out)

I do not have any reference to the Home sheet in the custom xml code, although I added one to see if it would resolve the error but it did not. I subsequently removed the code from the xml.

Is there any modifications to my code that would keep the error from occurring on startup? When opening the workbook by itself it does not show the error.

Thank you for reading. Hope you can help.

Louis
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hello. I'm reposting this question in the hopes I can get some direction. I've added a screenshot.

To summarize, if I open the WB seen below by itself, I do not get the error. If opened via VBA, the error occurs...twice. I'm looking for a fix or workaround to prevent the error from occurring.
 

Attachments

  • Untitled-1.jpg
    Untitled-1.jpg
    195.5 KB · Views: 13
Upvote 0
This question is from 2021, but yes, all is well. Thank you.
 
Upvote 0
This question is from 2021, but yes, all is well. Thank you.
Hi JLouis, I have the same problem. Could you recall how you solve the problem and share with me? Thank you very much!
 
Upvote 0
I don't recall the specifcs, but I think I started with debugging the code.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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