Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Add macro icon to a toolbar

    I want to have an icon automatically added to the Format toolbar when Word starts. I thought that I would locate the macro and associated code, making it appear, in a template located in the startup folder.
    Problem - I cannot find any reference for generating the code to add the toolbar icon.
    Can anyone point me to a reference or explain how to build this code?
    Thanks
    Norman

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Add macro icon to a toolbar

    Hi Norman,

    Besides the information that's available in VBA's help files, you can find a very detailed discussion of working with commandbars via code in Chapter 6 of MS Press' Office 2000 Visual Basic Programmer's Guide.

    The entirety of this book is actually available online at the MSDN website - <A target="_blank" HREF=http://msdn.microsoft.com/library/default.asp?URL=/library/techart/officeanchor.htm>this link </A> should take you there (or near there - look for 'Office Developer Documentation and expand the views from there) - you can navigate the TOC pane on the left side of the screen, to locate the "Working with command bars" section of Chapter 6.

    While working with toolbars programmatically is fun stuff, you can also achieve what you want simply by customizing the template in the startup folder, to include the icon (and associated command or macro) you want. The template will load whenever Word starts, and accordingly the icon will appear.

    Gary

  3. #3
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,048
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Add macro icon to a toolbar

    Hi Norman,

    I'm not sure why you want to do this with code rather than simply adding the button to the formatting toolbar in your global template that contains the macro. Otherwise, you are changing some template and will have to deal with "Save changes to template?" dialogs. Besides, it is messier.

    You may want to look at (<A target="_blank" HREF=http://www.addbalance.com/usersguide/templates.htm>http://www.addbalance.com/usersguide/templates.htm) for more on templates (user and workgroup), document templates, global templates and Normal.dot. This also includes how the files are organized under File New and the location of template folders which varies not only by version of Word but also by operating system.
    Charles Kyle Kenyon
    Madison, Wisconsin

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add macro icon to a toolbar

    Gentlemen:
    Thank you for the obvious solution. I was so engrossed working on my macro I got lost in the trees and missed the forest.
    Gary, thanks for the VBA reference; I was not aware of it.
    Charles, thanks for your comments. I have read your articles a number of times and they are great.
    Norman

Posting Permissions

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