Print Page | Close Window

Changing RibbonBar Captions

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=3825
Printed Date: 21 June 2025 at 12:59pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Changing RibbonBar Captions
Posted By: jcollier
Subject: Changing RibbonBar Captions
Date Posted: 21 March 2006 at 3:46pm
I am trying to change the caption of one of my submenus that expands down from a RibbonBar.

Can anyone help with the following code?

private sub SetUpRibbonBar
    Dim tabBatches As RibbonTab
    Dim RibbonBar As RibbonBar
    Dim GroupBatches As RibbonGroup
    Dim ControlRibbonButton As CommandBarPopup
   
    Set RibbonBar = CommandBars.AddRibbonBar("MainRibbon")
    Set tabBatches = RibbonBar.InsertTab(0, "Batches")
    Set GroupBatches = tabBatches.Groups.AddGroup("Batch Functions")
   
    Set ControlRibbonButton = GroupBatches.Add(xtpControlSplitButtonPopup, ID_CREATEBATCH, "Create")
        ControlRibbonButton.CommandBar.Controls.Add xtpControlButton, ID_CREATEBATCH, "Create Batch"
        ControlRibbonButton.CommandBar.Controls.Add xtpControlButton, 0, "Create Imageless Batch"
       
    GroupBatches.Add xtpControlButton, ID_CLOSEBATCH, "Close Batch"
   
    Set GroupBatches = tabBatches.Groups.AddGroup("Queues")
    Set ControlRibbonButton = GroupBatches.Add(xtpControlSplitButtonPopup, ID_QUEUES, "Queues")
        ControlRibbonButton.CommandBar.Controls.Add xtpControlButton, ID_INPRODUCTION, "In Production", -1, False
        ControlRibbonButton.CommandBar.Controls.Add xtpControlButton, ID_INBILLING, "In Billing", -1, False
       
    CommandBars.Icons = imCommandBar.Icons
   
    Set ControlRibbonButton = CommandBars.FindControl(xtpControlButton, ID_INPRODUCTION, , True)
    Debug.Print ControlRibbonButton.Caption   '<----Returns "Queues".  I want it to return "In Production"

End Sub

ID_QUEUES = 9
ID_INPRODUCTION = 12

I'm sure it's something simple but I can't seem to get it.



Replies:
Posted By: Oleg
Date Posted: 22 March 2006 at 7:56am

Hello,

Just tried to change our sample and it worked as expected.

I sure the problem in ID_QUEUES and ID_INPRODUCTION   - may be they are declared somewhere as private.

 

Declare them as

Public Const ID_QUEUES = 9

Public Const ID_INPRODUCTION = 12

 

try to add

Option Explicit
in the biginning of file to see if these constants are visible.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Oleg
Date Posted: 22 March 2006 at 7:57am

also replace

Dim ControlRibbonButton As CommandBarPopup

to

Dim ControlRibbonButton As CommandBarControl



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: SuperMario
Date Posted: 22 March 2006 at 7:58am
Hmm,
I'm not sure why you don't get type mismatch.

Try:
Dim ControlRibbonButton As CommandBarControl


Posted By: jcollier
Date Posted: 22 March 2006 at 3:59pm
Changing to Dim ControlRibbonButton as CommandBarControl worked.

My contants were fine, didn't have to change anything.

Thanks!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net