Results 1 to 20 of 25

Thread: How does one activate ribbon components from an xlam file ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    BTW, just for info, this is the code I created

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
              onLoad="rxDemoRibbonOnLoad"> 
    
        <ribbon>
            <tabs>
                <tab id="tabDemo" label="Demo Ribbon">
    
                    <group id="grpDemoGroup1" 
                           label="Initial Group" 
                           visible="true">
    
                        <button id="btnDemoShowRest"
                                onAction="rxDemoShowRest" 
                                label="Show Rest"  
                                imageMso="FileWorkflowTasks"
                                size="large"
                                visible="true"
                                enabled="true" />
                    </group>
    
                    <group id="grpDemoGroup2" 
                           label="Now You See Me" 
                           getVisible="rxDemoGetVisible">
    
                        <button id="btnDemoButton1"
                                onAction="rxDemoButton1" 
                                label="New Button 1"  
                                imageMso="ReviewProtectWorkbook"
                                size="large"
                                visible="true"
                                enabled="true" />
    
                        <button id="btnDemoButton2"
                                onAction="rxDemoButton2" 
                                label="New Button 2"  
                                imageMso="StartTimer"
                                size="large"
                                visible="true"
                                enabled="true" />
    
                        <button id="btnDemoButton3"
                                onAction="rxDemoButton3" 
                                label="New Button 3"  
                                imageMso="FileSaveAsPowerPointPpsx"
                                size="large"
                                visible="true"
                                enabled="true" />
                    </group>
                </tab> 
            </tabs>
        </ribbon>
    </customUI>
    Private Sub Workbook_Open()
        flgShowRest = False
    End Sub
    Global flgShowRest As Boolean
    Global rxDemoIRibbonUI As IRibbonUI
    
    Public Function rxDemoRibbonOnLoad(ribbon As IRibbonUI)
    
        Set rxDemoIRibbonUI = ribbon
            
        If Val(Application.Version) >= 14 Then rxDemoIRibbonUI.ActivateTab "tabDemo"
    End Function
    
    Public Function rxDemoGetVisible(control As IRibbonControl, ByRef Visible)
        
        Select Case control.ID
            
            Case "grpDemoGroup2":                   Visible = flgShowRest
        End Select
    End Function
    
    Public Function rxDemoShowRest(control As IRibbonControl)
        flgShowRest = Not flgShowRest
        rxDemoIRibbonUI.Invalidate
    End Function
    Attached Files Attached Files
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •