+ Reply to Thread
Results 1 to 7 of 7

Macro's assigned to a custom toolbar button don't run after renaming the worksheet

  1. #1
    Registered User
    Join Date
    11-23-2007
    Posts
    2

    Macro's assigned to a custom toolbar button don't run after renaming the worksheet

    I have to simple macros assigned to two different buttons on a custom toolbar. It works fine until the location of the worksheet (or the worksheet name) is changed to another directory. When opening the worksheet and using the toolbar, an error message is shown that the macro couldnīt be found on the original file location.

    Of course, the macros are in the workbook and can be reassigned to the toolbar again....

    Anyone knows how to make these macro mappings independent of the worksheet's file location (or worksheetīs name)?

    Marcel

  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
    Do you assign the macros in code or via the user interface? If the former, can you post the code?

  3. #3
    Registered User
    Join Date
    11-23-2007
    Posts
    2
    The macro is written in code (see below)
    I've assigned it to a toolbar using the user interface (using the 'assign macro....' menu option.

    Marcel

    Please Login or Register  to view this content.
    Last edited by marcelw; 11-25-2007 at 03:33 PM. Reason: Tagged VB code as code

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    marcelw

    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Registered User
    Join Date
    11-08-2007
    MS-Off Ver
    2021 Prof
    Posts
    84

    Macro Buttons

    I have a similar problem .. but for me the macro still runs but if I use the toobar icon it refers back to the old worksheet

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Sorry for the delay in responding, and please do edit your post to add code tags as mudraker requests.

    I reckon you create hard-coded links to the workbook path when you assign a macro to a toolbar button via the UI (I know this is true for macros in add-ins). Try assigning the button in the workbook open event.

  7. #7
    Registered User
    Join Date
    11-08-2007
    MS-Off Ver
    2021 Prof
    Posts
    84

    Macro Button

    Is that to assign the macro to a toolbar custom button ... I cant work out how to do ?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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