Consulting

Results 1 to 12 of 12

Thread: I'm making PPT Addin and cant get buttons to arrange vertical!

  1. #1

    Angry I'm making PPT Addin and cant get buttons to arrange vertical!

    Hello all,

    Ive made a custom addin for 4 macros ive made and the buttons show up but are arranged horizontally and I want them vertically.

    Is this possible? You can see in the picture attached that the left set of commands that someone sent me are vertical. My 4 macros to the right are not!

    Capture.jpg

  2. #2
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    6,772
    Location
    http://www.vbaexpress.com/forum/show...ons-per-column

    Post #2 has example of using <box> tag in CustomUI
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    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)
    (multiple files can be selected while holding Ctrl key) / 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

  3. #3
    Hey,
    Thanks for the quick reply. Ill go check it out!

  4. #4
    That thread was for making buttons on the ribbon in XML while I've been using VBA to make mine. As such it likely wont work for me =\

  5. #5
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,882
    Location
    You should be using open XML if you have a version from 2007 onwards. You will find the command bars method in vba extremely limited. The three vertical menus were almost certainly programmed in XML.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  6. #6
    Quote Originally Posted by John Wilson View Post
    The three vertical menus were almost certainly programmed in XML.
    in fact they are not.
    I have their source code and I think the only difference is that when menus (and not buttons) are used, they stack vertically by default.

    I only plan on including 4-10 macros activated by buttons in the ribbon and (they will normally be run by: ALT+X+C or something like that. I think the non-XML method suits me well enough for this, I just wish I could make them look the way I want.

    Is there an easy way (maybe a tutorial) to convert my VBA code into XML? This is a small side project and I dont really have time to learn new languages/syntax just for a cosmetic issue.

  7. #7
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,882
    Location
    If you code in vba for menus which in 2003 (where it is the correct method) they would appear as new menus on the toolbar. Since the toolbar doesn't exist as such in 2007 on it will do the best it can. Sometimes it just will fail and other times it stacks them as you have in the AddIns tab. If you program toolbars, as I guess you have, it will show as a single row unless you add a new command bar for each button (which would be clumsy). There is very little control. The XML method gives you the control you need (and much more) but as you say it's a new skill to learn.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  8. #8
    Hey, I think there might be a way to include XML code in my VBA version already?

    for reference, here is what i have so far:

    Sub Auto_Open()
        Dim oToolbar As CommandBar
        Dim oButton As CommandBarButton
        Dim MyToolbar As String
    
        ' Give the toolbar a name
        MyToolbar = "Analyst Toolkit"
    
        On Error Resume Next
        ' so that it doesn't stop on the next line if the toolbar's already there
    
        ' Create the toolbar; PowerPoint will error if it already exists
        Set oToolbar = CommandBars.Add(Name:=MyToolbar, _
            Position:=msoBarFloating, Temporary:=True)
        If Err.Number <> 0 Then
              ' The toolbar's already there, so we have nothing to do
              Exit Sub
        End If
        'oToolbar.Width = 100
        
        On Error GoTo ErrorHandler
    
    'Button 1
        Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
    With oButton
        .DescriptionText = "Copy Size & Position"
        .Caption = "&Copy Size/Position"
        .OnAction = "CopyPositionSize"
        'Runs the Sub CopyPositionSize() code when clicked
        .Style = msoButtonIconAndWrapCaption
        .FaceId = 3985
        End With
    
    
    'Button 2
        Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
        With oButton
        .DescriptionText = "Paste Size & Position"
        .Caption = "&Paste Size/Position"
        .OnAction = "PastePositionSize"
        'Runs the Sub CopyPositionSize() code when clicked
        .Style = msoButtonIconAndWrapCaption 
        .FaceId = 4157
        End With
        
    'Button 3
        Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
        With oButton
        .BeginGroup = True
        .DescriptionText = "Save Copy with No Links"
        .Caption = "Export and &Break Links"
        .OnAction = "BreakAllLinks"
        'Runs the Sub CopyPositionSize() code when clicked
        .Style = msoButtonIconAndWrapCaption
        .FaceId = 2647
        End With
        
    'Button 4
        Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
        With oButton
            .DescriptionText = "Save Copy with No Links"
            'Tooltip text when mouse if placed over button
            .Caption = "Export, Break Links and &Email"
            'Text if Text in Icon is chosen
             .OnAction = "BreakAllLinksAndEmail"        'Runs the Sub CopyPositionSize() code when clicked
            .Style = msoButtonIconAndWrapCaption
            .FaceId = 2986
        End With
        
    oToolbar.Visible = True
    
    
    NormalExit:
        Exit Sub   ' so it doesn't go on to run the errorhandler code
    
    
    ErrorHandler:
         'Just in case there is an error
         MsgBox Err.Number & vbCrLf & Err.Description
         Resume NormalExit:
    
    
    End Sub

  9. #9
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,882
    Location
    There's a start tutorial for using XML in the ribbon on our page. Look at the last sample and simply remove size="large" in each line leaving just a space which will give you small buttons stacked in threes.

    Really, you are just making work for yourself using Steve's very old legacy code which is from a version over 10 years old.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  10. #10
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,882
    Location
    Here's a sample
    Last edited by John Wilson; 02-03-2017 at 08:27 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  11. #11
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,882
    Location
    Here's a sample (spelling corrected)

    AddIn_XML.pptm
    Last edited by John Wilson; 02-03-2017 at 08:27 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  12. #12
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    6,772
    Location
    A good reference is

    https://msdn.microsoft.com/en-us/lib...ffice.12).aspx



    and I added an example and code and etc. to the other post in the Ribbon forum


    http://www.vbaexpress.com/forum/show...ons-per-column
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    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)
    (multiple files can be selected while holding Ctrl key) / 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

Tags for this Thread

Posting Permissions

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