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


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).
Who is Participating?
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

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.

Joanne M. OrzechManager, Document Services CenterCommented:
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?
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

afflik1923Author Commented:
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!
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.

afflik1923Author Commented:
Never got to test this code in the end because of various events but I assume it worked and the input was very helpful
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.