Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts

    Word 2010 macro not showing on Add-ins tab

    This is probably a silly question, but I can't see why one of the three macros in a template does not display as a Toolbar Command on the Add-ins tab along with the other two.

    I would be very grateful for your help.

    Regards
    useful

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Useful,

    Is it a Sub or a Function? Functions will not show. HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts
    Thanks for your response RetiredGeek, glad you are still providing your valuable assistance!

    This macro is a Sub, just like the other two macros that do appear on the Add-ins tab.

    Regards
    useful

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Useful,

    Could you possibly post a copy of the template?
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts
    Hi RetiredGeek, thank you for the follow-up.

    I forgot to elaborate that I created this template years ago and since converted to Word 2010 and expected to see the new macro I created on the Add-ins tab and it wasn't there.

    The template is attached.

    Thank you in advance.

    Regards
    useful
    Attached Files Attached Files

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Macros don't appear in add-ins automatically. The old macros were probably added as buttons on the toolbar on a Word 2003 (or earlier) machine. When such a template is opened in Word 2007+ those buttons appear on the Addins tab.

    The easiest way to add the new button is to take your template back to a Word 2003 machine and add the button to the toolbar.

    Failing that, you could use a macro to create the button - see http://stackoverflow.com/questions/5...ndler-to-excel for an example of the code that could be used. You should be able to use that code with only a single modification to specify your macro name.

    The 'modern' way of putting buttons onto the ribbon is far more complicated than the old way.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts
    Thank you for the explanation Andrew - so that's why the macro is not on the Add-ins tab!

    Unfortunately for me, I can't really write VBA code, I just recorded those macros, so as a result I don't really know what to do with the code you so kindly pointed me to.

    All I want to do is to add the new macro to the Add-ins tab, with an icon, just like the other two macros already there. I don't really want to add another Toolbar, nor do I have a machine that is running Word 2002 any longer.

    In that case, which part of the code do I use?

    Thank you in advance.

    Regards
    useful

  8. #8
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    OK, the following modified extract is all you need. Paste the code into one of your template's modules and then run the macro called AddThisButton
    Code:
    Public Sub AddThisButton()
      AddAnyButton "Page2", "Run the Page2 macro", 526, "Page2"
    End Sub
    
    Private Function AddAnyButton(caption As String, tooltip As String, faceId As Long, methodName As String)
      Dim Btn As CommandBarButton
      Set Btn = Application.CommandBars(1).Controls.Add
      With Btn
        .Style = msoButtonIcon
        .faceId = faceId ' choose from a world of possible images in Excel: see http://www.ozgrid.com/forum/showthread.php?t=39992 '
        .OnAction = methodName
        .TooltipText = tooltip
      End With
    End Function
    Note that your macro's result depends heavily on where the cursor is when the macro is run. It would be greatly improved if you can recreate the macro so it is less dependent on cursor location.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    useful (2015-05-31)

  10. #9
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts
    Thank you Andrew.

    I will try this code in the morning, although I don't pretend to understand what you mean by 'recreate the macro so it is less dependent on cursor location'.

    Regards
    useful

  11. #10
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts
    Hi Andrew

    I have tested it and it works fine!

    Thank you again.

    Regards
    useful

  12. #11
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts
    Hi Andrew

    I forgot to ask you, could you please tell me where I can find a list of the icons, one of which, 526, you inserted into the code.

    Thank you.

    Regards
    useful

  13. #12
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Read back through the code - the answer is there.

    The Ozgrid thread has two sources. One requires you to join Ozgrid, the other is a download from Microsoft.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  14. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    useful (2015-06-02)

  15. #13
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    269
    Thanks
    32
    Thanked 0 Times in 0 Posts
    Thank you again Andrew.

    Regards
    useful

Posting Permissions

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