Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having problems loading backstage ribbon

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
0
0
US
I'm trying to load the backstage ribbon programmatically using LoadCustomUI. I can't get it to work. However, if I place the same xml code in the USysRibbons table it loads, does what it's told and fires the onload event. This does NOT happen when it is loade programmatically.

When the backstage ribbon is loaded via the USysRibbons table, the onLoad event fires. But, if I load the ribbon via code, the onLoad event does NOT fire. If I try to execute the code to load the ribbon a 2nd time, I'm told that the ribbon already is loaded. I have spent several hours trying to figure this out.

What am I doing wrong?

MyonRibbonLoade event
Code:
Public Function MyonRibbonLoad(Ribbon As IRibbonUI)
    MsgBox "here i am"
End Function

Load Ribbon Function
Code:
Public Function LoadRibbon()
    Dim strRib As String
    strRib = "<customUI xmlns=""[URL unfurl="true"]http://schemas.microsoft.com/office/2009/07/customui""[/URL] onLoad=""MyonRibbonLoad"" > " & _
                "<backstage> " & _
                    "<tab    idMso=""TabInfo""                     visible=""false""/> " & _
                    "<button idMso=""FileSave""                    visible=""false""/> " & _
                    "<button idMso=""SaveObjectAs""                visible=""false""/> " & _
                    "<button idMso=""FileSaveAsCurrentFileFormat"" visible=""false""/> " & _
                    "<button idMso=""FileOpen""                    visible=""false""/> " & _
                    "<button idMso=""FileCloseDatabase""           visible=""false""/> " & _
                    "<tab    idMso=""TabRecent""                   visible=""false""/> " & _
                    "<tab    idMso=""TabNew""                      visible=""false""/> " & _
                    "<tab    idMso=""TabPrint""                    visible=""false""/> " & _
                    "<tab    idMso=""TabShare""                    visible=""false""/> " & _
                    "<tab    idMso=""TabHelp""                     visible=""false""/> " & _
                    "<button idMso=""ApplicationOptionsDialog""    visible=""true""/> " & _
                    "<button idMso=""FileExit""                    visible=""false""/> " & _
                "</backstage> " & _
            "</customUI>"
    
    Application.LoadCustomUI "MMC_AppRibbon", strRib

End Function
 
Just as a matter of interest, when I added your ribbon to a form by setting the ribbon name property manually, your function ran.

 
Interesting...The only way I could get it to work was to make sure I loaded the backstage ribbon at startup before any forms were loaded. I do have a form that runs in the background (hidden) that acts as a timer. I will try setting the ribbon name manually there and see if that works (per your suggestion).

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top