PDA

View Full Version : What kind of dimension is a ribbon?



RandomGerman
08-13-2015, 07:55 AM
Hi there,

a few weeks ago Paul taught me how to make my tab the active one (thank you!), using:


Sub OnRibbonLoad(ribbon As IRibbonUI)
Set oRibbon = ribbon
oRibbon.ActivateTab ("MyTab")

End Sub

This used to work fine, as long as I didn't use Option Explicit. Now debugging asks what kind of variable "oRibbon" is. Can anyone help me? Thanks in advance!

RG

btw: I use 2010.

Paul_Hossler
08-17-2015, 06:22 AM
Dim oRibbon As IRibbonUI



14203

RandomGerman
08-17-2015, 08:41 AM
Thank you, Paul.

The new code:


Public myRibbon As IRibbonUI

Sub OnRibbonLoad(ribbon As IRibbonUI)
Dim oRibbon As IRibbonUI
Set oRibbon = ribbon
oRibbon.ActivateTab ("MyTab")

End Sub

This works perfect on my machine. I tried to install the same add-in on a different machine and there the ribbon appears and all other macros work well - but the ribbon is not in front, when opening PowerPoint. I remember, one reason could be the PowerPoint version, but as mine is 2010 and the other one is 2013 it shouldn't be the point. Or am I going wrong here? Are any other possible reasons known?

Paul_Hossler
08-17-2015, 11:57 AM
Might be a scope issue -- try this




Public oRibbon As IRibbonUI

Sub OnRibbonLoad(ribbon As IRibbonUI)
Set oRibbon = ribbon
oRibbon.ActivateTab ("MyTab")

End Sub

RandomGerman
08-18-2015, 07:08 AM
Same result. Works on the 2010 machine, doesn't work on the other one. But I found out a new detail: The problem only appears with the ppam. For the pptm it works. Is anything known about this? Maybe a saving issue? Or security settings?

Paul_Hossler
08-18-2015, 10:29 AM
Make sure that the Add-ins folder is a trusted location

I don't have 2013 on any of the computers

RandomGerman
08-21-2015, 02:45 AM
It is a trusted location. That wasn't the point. Thank you for trying, Paul. Maybe I should repost the problem in the PowerPoint group as there is more traffic. Maybe someone there has already heard of the problem.

Andy Pope
08-22-2015, 06:28 AM
The following worked for me ppt 2013



Public gRibbonUI As IRibbonUI

Sub rbx_onLoad(ribbon As IRibbonUI)
Set gRibbonUI = ribbon
gRibbonUI.ActivateTab "Tab1"
End Sub


Saved as a pptm the tab was activated when file was opened.
Saved as a ppam the tab was activated when addin was loaded via the addin dialog. In fact you can use the checkbox in the dialog to see the tab disappear and appear with focus.

I would assume the problem is the focus is being moved by the opening of a presentation file.

RandomGerman
08-26-2015, 08:05 AM
Hi Andy,

thank you for your thoughts.

The way I load up the ppam is:
Save it to C:/Users/MyName/AppData/Roaming/Microsoft/Addins
Open PowerPoint, go to File, go to Options, go to Addins
Go to Manage at the bottom of the window, choose PowerPoint Addins, then click Go
And in the new window click on "Add new" and select the ppam.

The tab appears, every macro works - except the one to make the tab the active one, while even this macro works when I open the pptm on the same machine.

Do you see any mistake in my way to proceed?

Thank you!
RG