Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Macros / Custom Toolbar Help - Word 2007/2010

Posted on 2010-09-21
5
Medium Priority
?
1,342 Views
Last Modified: 2012-05-10
I have a DOT file that I need to modify  - it was created in Word 2003.  There are 10+ macros assigned to the custom toolbar.  

I need to know how, in Word 2010 (or 2007, which I also have) I can do the following:
a) find out which macro is assigned to a specific icon on the toolbar; and
b) create / copy it to a different template (which also has to be in "DOT" (not DOTM/DOTX) format.

I've looked at a ton of reference materials but am not finding this.  

The DOT needs to work in 2003.
0
Comment
Question by:aaepa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Assisted Solution

by:PandaPants
PandaPants earned 1000 total points
ID: 33729457
I have neither Word 2010 nor 2007, but I can give you something that will likely work, if you want to take the time:
Since you have access to the template, open it up to where you can see the code, then put a break point at the beginning of each macro or function. Return to the Word window and run the first macro on the toolbar; the code should stop immediately at one of the break points you assigned. Make a note, and move on to the next one.

If there are many more macros in the template than on the toolbar, there will be a lot of prep involved, but it will work eventually. (Unless, of course, some of the toolbar icons refer to macros in other templates that are assumed to be available...but we don't have to go there right away.) Good luck.
0
 
LVL 8

Expert Comment

by:PandaPants
ID: 33729502
Sorry, I forgot to address your second question, regarding sharing. For that, use the 2010 equivalent (I'm assuming there is one) of the Organizer tool to copy the code modules from one template to another.

If you want to copy *only* the 10 or so macros that are directly called from the toolbar, and they're not already all in the same module, you can either (a) create a new module and copy those macros to that new module with the copy-and-paste method, or (b) copy all the modules to the new template and then delete those macros that you don't need.

A word of caution, probably not needed: It's possible--even likely--that the macro called by the toolbar icon actually chains to other macros that aren't directly referenced from the toolbar, and those macros may link to others still. So, even if you identify the 10 macros on the toolbar, you may actually need to copy more than those in order to retain functionality.

Again, it's a timeconsuming process if the web is tangled, but it is possible to follow each and every thread. Have patience...and hope another expert comes along with a better solution!
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 1000 total points
ID: 33733400
This code will list all the buttons which run macros. It was designed in Word 2003
Sub ListButtons()
    Dim bar As CommandBar
    Dim but As CommandBarControl
    Dim tbl As Table
    Dim rw As Row
    Dim rng As Range
    
    
    Set tbl = ActiveDocument.Tables.Add(ActiveDocument.Bookmarks("\EndOfDoc").Range, 1, 4)
    tbl.Cell(1, 1).Range.Text = "Toolbar"
    tbl.Cell(1, 2).Range.Text = "Button"
    tbl.Cell(1, 3).Range.Text = "On Action"
    tbl.Cell(1, 4).Range.Text = "Icon"
    
    For Each bar In CommandBars
        For Each but In bar.Controls
            If but.Type = msoControlButton Then
                If Len(but.OnAction) > 0 Then
                    Set rw = tbl.Rows.Add
                    
                    rw.Cells(1).Range.Text = bar.Name
                    rw.Cells(2).Range.Text = but.Caption
                    rw.Cells(3).Range.Text = but.OnAction
                    
                    but.CopyFace
                    Set rng = rw.Cells(4).Range
                    rng.Collapse wdCollapseStart
                    rng.Paste
                End If
            End If
        Next but
    Next bar
End Sub

Open in new window

0
 

Author Closing Comment

by:aaepa
ID: 33736795
Thank you... I have it working now - I found the missing macro :).  FYI - there is no way in 2007 or 2010 to edit a custom toolbar that appears in "Add-Ins" (at least that is what I have read in numerous places today!)  It can be added to the quick access toolbar, but not to an "add-in".  
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 33738182
Hi thanks. I'm glad that you're sorted.

The macro should list add-ins with a button starter in Word 2007. It did in my tests.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

715 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