FancyPrairie
Programmer
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
Load Ribbon Function
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