Excel VBA Ribbon code not working in 2013

john robinson

New Member
Joined
Sep 7, 2015
Messages
6
I have some software which opens a template workbook. This book has several sheets and each sheet has a different ribbon arrangement. When the sheet changes from one to another, it invalidates the ribbon and forces it to rebuild, using callbacks linked to the particular sheet, giving us the correct ribbon for that sheet. The software will open several of these template books at a time. Up to Excel 2010 this works fine but in 2013, one book is fine but if I open a second the first book stops changing the ribbon. It appears that the RibbonUI object is no longer set so it won't rebuild.
When loaded it sets the ribbon bu tI can't reset it when the book is open.
Sub ribb******ed(ribbon As IRibbonUI)
ThisWorkbook.ribbonUI = ribbon
End Sub

Has anyone come across this or got a fix for it.
Most grateful for any pointers.
John
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You appear to be missing a Set statement there unless this is not VBA.
 
Upvote 0
You appear to be missing a Set statement there unless this is not VBA.
I tried adding a set as suggested and I agree seemed sense but it errored out!
Sub ribb******ed(ribbon As IRibbonUI)
set ThisWorkbook.ribbonUI = ribbon
End Sub
John
 
Upvote 0
What is the declaration of ribbonUI in the ThisWorkbook module?
 
Upvote 0
Public myribbon As IRibbonUI
Works great in 2007 and 2010. I'm wondering if it is to do with the changes in the way Excel windows/frames work in 2013.
John
 
Upvote 0
What's the error message when you use Set?
 
Upvote 0
That's odd. Can you put a sample workbook somewhere (Dropbox / Onedrive / other sharing site) for testing?
 
Upvote 0
The problem is that the workbook is created from a template by the main programme workbook and is heavily referenced to that. So it won't work as standalone. I think I need to try and make a standalone version and see how that works. When done I will be happy to share if I get the same problem. Most grateful for your interest.
John
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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