+ Reply to Thread
Results 1 to 5 of 5

Macro runs using F5 but not when clicking custom button on ribbon

  1. #1
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Macro runs using F5 but not when clicking custom button on ribbon

    I have a macro in a file; this file is dedicated to providing macros. This file is kept in the Word STARTUP folder so it is loaded but not visible every time Word starts. Several Quick Access Toolbar (QAT) buttons are bound to macros in this file.

    I have added two Ribbon buttons to run macros in this file. At first, it worked fine. Now the buttons do not do anything. I cannot think of anything that changed since I installed the buttons. I have put checkpoints in the code and the Subs are not being invoked. If I open the file and then look at the code (you must have the file open to be able to edit the code, even though the file appears in the VBA window when it's not opened) I can run the code using F5, so this does not appear to be a macro security issue. I can click other buttons on the QAT that successfully run macros in the same file.

    I have sometimes experienced buttons that get disconnected from their macros, so I tried re-adding buttons, but the new buttons do not work either. I tried adding a button to the QAT but that doesn't work either.

    What can cause a button to fail to activate a macro when the macro can be run using F5 in the code?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro runs using F5 but not when clicking custom button on ribbon

    I've not done this in Word, Jeff, but by analogy with Excel,

    Is it installed as an add-in?

    ... or ...

    Have you created a recognizable project name and set a reference?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro runs using F5 but not when clicking custom button on ribbon

    It's not an add-in. Shouldn't need a reference. Not sure exactly what you mean by "recognizable project name." In Word, as in Excel, the project name is the same as the file name. The confounding thing is that there are other macros in the same file with other buttons that all work fine.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro runs using F5 but not when clicking custom button on ribbon

    I got nuttin'

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro runs using F5 but not when clicking custom button on ribbon

    shg (or anyone else), if you're interested, the problem may be related to the fact that my Sub was named Save and maybe it had some sort of name collision. The Sub is in a module called Workspace, and it records the paths of all open files. There is also a Restore so that if I shut my computer down and restart I can bring my same session up again. (This used to be a feature of Microsoft Works, I think. Not sure why they didn't build it into Office.) When I changed the name of the Sub to SaveWorkspace, it started working as expected. Thanks for trying!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom Ribbon button color ??
    By Rmag in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2016, 12:50 PM
  2. Clicking a ribbon button with VBA?
    By JYTS in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-08-2016, 02:45 PM
  3. [SOLVED] Run Logon button under custom ribbon tab using VBA
    By v2k2apj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2013, 04:09 PM
  4. Populate dropDown in a custom ribbon on clicking a button
    By johnjacobt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2011, 05:02 AM
  5. Assigning a macro to a custom button in 2007 ribbon
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2009, 05:50 AM
  6. Custom Toolbar Button No Longer Runs Assigned Macro
    By Bryan in forum Excel General
    Replies: 1
    Last Post: 04-10-2006, 01:10 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1