Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your site is a great idea. I should have joined your site years ago. Better late than never..."

Geography

Where in the world do Tek-Tips members come from?
FancyPrairie (Programmer)
13 Jun 12 12:07
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=""http://schemas.microsoft.com/office/2009/07/customui"" 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
Remou (TechnicalUser)
27 Jun 12 6:33
Just as a matter of interest, when I added your ribbon to a form by setting the ribbon name property manually, your function ran.

http://lessthandot.com

FancyPrairie (Programmer)
27 Jun 12 8:30
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

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close