Results 1 to 17 of 17

Thread: How to limit the ribbon to 2 normal size icons per column

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #17
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,894
    Location
    This is the most straight forward way to do it. There are more elegant ways

    You don't use the add commandbar logic. Use the CustomUI editor ....

    http://openxmldeveloper.org/blog/b/o...8/06/7293.aspx

    http://openxmldeveloper.org/cfs-file...ditorSetup.zip


    ....to add this to your XLSM or PPTM.

    Once there save it as the appropriate addin (i.e. PPAM)

    You can use built in icons, add your own, or not use any. I just used ABCD because it's easy

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="cbOnRibbonLoad" >
    
    <ribbon>
    <tabs>
    <!-- Add Custom group to the Home tab in the ribbon -->
    <tab id="myTab" label="My Tab">
     <group id="myGroup" label="My Addin">
      <box id="box4" boxStyle="vertical">
       <button id="bCopyPosition" label="Copy Pos" onAction = "cbCopyPositionSize" imageMso="A"/>
       <button id="bPastePosition" label="Paste Pos" onAction = "cbPastePositionSize" imageMso="B"/>
       <button id="bBreakLinks" label="Break Links" onAction = "cbBreakAllLinks" imageMso="C"/>
       <button id="bBrealLinksEmail" label="Break Email" onAction = "cbBreakAllLinksAndEmail" imageMso="D"/>
      </box>
     </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>

    The callbacks (i.e. what the button calls) look like these

    Option Explicit
    Public oRibbon As IRibbonUI
    
    'Callback for customUI.onLoad
    Sub cbOnRibbonLoad(ribbon As IRibbonUI)
        Set oRibbon = ribbon
    End Sub
    
    'Callback for bCopyPosition onAction
    Sub cbCopyPositionSize(control As IRibbonControl)
        CopyPositionSize
    End Sub
    
    'Callback for bPastePosition onAction
    Sub cbPastePositionSize(control As IRibbonControl)
        PastePositionSize
    End Sub
    
    'Callback for bBreakLinks onAction
    Sub cbBreakAllLinks(control As IRibbonControl)
        BreakAllLinks
    End Sub
    
    'Callback for bBrealLinksEmail
    Sub cbBreakAllLinksAndEmail(control As IRibbonControl)
        BreakAllLinksAndEmail
    End Sub


    Each button call back then calls your 'real' macro. These are just stubs

    Option Explicit
    Sub CopyPositionSize()
        MsgBox "CopyPositionSize"
    End Sub
    
    Sub PastePositionSize()
        MsgBox "PastePositionSize"
    End Sub
    
    Sub BreakAllLinks()
        MsgBox "BreakAllLinks"
    End Sub
    
    Sub BreakAllLinksAndEmail()
        MsgBox "BreakAllLinksAndEmail"
    End Sub

    Look through the threads in this forum for ideas, and there are many 'how to' references on the web


    Capture.JPG


    This is for Excel because that's what I had handy (the process is the same), but John was also kind enough to add more references and a PP addin example to the original thread


    http://www.vbaexpress.com/forum/show...range-vertical!
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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