[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1772
  • Last Modified:

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

Hi,

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).
Thanks
0
afflik1923
Asked:
afflik1923
  • 3
  • 2
2 Solutions
 
dmangCommented:
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)
        Else
            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.TypeParagraph
    Selection.TypeText "CommandBar: " & cb.Name & vbCrLf
    Selection.MoveDown unit:=wdLine, Count:=2
   
    For Each objControl In cb.Controls
        If objControl.BuiltIn = True Then
        Else
            Selection.TypeText "Custom Toolbar" & vbCrLf & vbCrLf
        End If
            Select Case objControl.Type
                Case msoControlPopup, _
                     msoControlButtonPopup, _
                     msoControlGraphicPopup, _
                     msoControlSplitButtonPopup
                     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

                    objControl.CopyFace
                    Selection.Paste
                    Selection.TypeText strText
                    Selection.TypeParagraph
            End Select
        'End If
    Next
   
    Set objControl = Nothing
    Set objPopupControl = Nothing    

End Sub

Regards
dmang
0
 
dmangCommented:
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.

dmang
0
 
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?
2003-AddIns.jpg
2007-AddIn.jpg
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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!
0
 
dmangCommented:
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.

dm
0
 
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
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now