Customise buttons in Word - Macro button icons - Export from word 2003 into Word 2007

Posted on 2009-02-18
Last Modified: 2012-05-06

My client makes use of Macros and adds custom buttons to the tool bars for these macros.
I learnt that actually someone in the office was just manually drawing the Macro buttons on the option to do this.
Some users have had to move to Office 2007.

I would like to be able to export the many custom icons they have created for Word 2003 buttons so that these are available in Word 2007. In fact I would like to create a standard list of Macro functions with consistant icons associated across the company rather then the random collection they have now.
can anyone point me in the right direction (basically how do I export the icon images and import them into Word 2007).
Question by:afflik1923
    LVL 9

    Accepted Solution

    Save this code in a Word module, and run the GetAllCB macro.
    You should get a list of all commandbars with their icon image, caption and control ID.  Custom toolbars (i.e. not "Builtin") are identified)
    Sub GetAllCB()
        Dim cb As CommandBar
        Dim strText As String
        For Each cb In Application.CommandBars
            If cb.Name = "WordCodePrint" Or cb.Name = "WordVBACodePrint" Then
                Call GetFaces(cb, strText)
                Call GetFaces(cb, strText)
            End If
        Next cb
    End Sub

    Sub GetFaces(cb, strText)
        Dim objControl As Office.CommandBarControl
        Dim objPopupControl As Office.CommandBarPopup
        On Error Resume Next
        Selection.TypeText "CommandBar: " & cb.Name & vbCrLf
        Selection.MoveDown unit:=wdLine, Count:=2
        For Each objControl In cb.Controls
            If objControl.BuiltIn = True Then
                Selection.TypeText "Custom Toolbar" & vbCrLf & vbCrLf
            End If
                Select Case objControl.Type
                    Case msoControlPopup, _
                         msoControlButtonPopup, _
                         msoControlGraphicPopup, _
                         strText = strText & vbCrLf & vbCrLf & _
                          objControl.Caption & _
                          " (Submenu) - " & objControl.ID
                        Set objPopupControl = objControl
                        Call GetFaces( _
                          objPopupControl.CommandBar, strText)
                     Case Else
                        strText = vbTab & _
                          objControl.Caption & " - " & objControl.ID

                        Selection.TypeText strText
                End Select
            'End If
        Set objControl = Nothing
        Set objPopupControl = Nothing    

    End Sub

    LVL 9

    Expert Comment

    A further note:
    Toolbars should appear in Word 2007 within the Addins area on the ribbon.  There should not really be the need to export anything.  When a doc, addin, or template is opened that provides a custom toolbar, it should be created as you would expect using Word 2002, 2003.

    LVL 37

    Assisted Solution

    by:Joanne M. Orzech
    I have found that all my add-in icons load the same way in Word 2007 as they do in Word 2003.  See images below.  Are you users drawing them on the Add-ins tab in Word 2007?

    Author Comment

    OK on this. So basically there is no real eas way just to say "Export button picutre" or similar. I have to run the code provided above?

    If I run the code above how will this let me transfer the icons to other PC's?
    Thanks again!
    LVL 9

    Expert Comment

    Hi there

    The code above can be changed to save the button faces as files.
    However, an existing document or template should contain any custom set button images and these should show wherever the file is used.
    Am missing something - like your folks want to use the custom images to create their own toolbars etc on a variety of machines?
    If this is the case, then the images should be saved and made available to all who need them.


    Author Closing Comment

    Never got to test this code in the end because of various events but I assume it worked and the input was very helpful

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
    This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
    In a previous video Micro Tutorial here at Experts Exchange (, I explained how to get a free, one-month trial of Office …

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now