+ Reply to Thread
Results 1 to 4 of 4

Moved file, changed path, macros don't work

  1. #1
    donbowyer
    Guest

    Moved file, changed path, macros don't work

    Excel 2003 with SP2 on Win XP Home
    I have an .xls file with macros run by custom toolbar buttons.
    I had to move the file to another location on my hard drive and so the
    reference path saved when I originally assigned the macro is no longer valid.
    When I click a custom toolbar button I get a message that the macro (in the
    old location) cannot be found.
    If I call up the toolbar customise dialog box / assign macro, the "macro
    name" window shows the file's old location. I can change this to the new one
    and then save the file. The custom buttons then work OK.
    But if I close the file then reopen it, the buttons no longer work, and I'm
    back to square one.
    I don't want to move the file back to its original location.
    Any suggestions for a solution would be welcome

    --
    donwb

  2. #2
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi Donwb,
    It sounds like the file is recreating the custom toolbar buttons each time it is opened, for example in a "workbook open" macro.
    However, the reference to the old location may also be used in other macros within the file. To find all references to the old path & change it to the new one in the code of all the macros:
    * While in Excel press [alt + F11] to open the VB Editor (where macro code is stored),
    * press [ctrl + r] to make sure the project window is open,
    * double click the "thisworkbook" option for your file,
    * use [ctrl + h] (& select search current project) to find & replace any references to the old path with the new one.
    * [alt + F4] to close the VB Editor, and save your file.

    Hopefully, now when you reopen your file the custom buttons will be assigned correctly.

    hth
    Rob Brockett
    NZ
    Always learning & the best way to learn is to experience...

  3. #3
    donbowyer
    Guest

    Re: Moved file, changed path, macros don't work

    Many thanks broro183 - that did it.
    --
    donwb


    "broro183" wrote:

    >
    > hi Donwb,
    > It sounds like the file is recreating the custom toolbar buttons each
    > time it is opened, for example in a "workbook open" macro.
    > However, the reference to the old location may also be used in other
    > macros within the file. To find all references to the old path & change
    > it to the new one in the code of all the macros:
    > * While in Excel press [alt + F11] to open the VB Editor (where macro
    > code is stored),
    > * press [ctrl + r] to make sure the project window is open,
    > * double click the "thisworkbook" option for your file,
    > * use [ctrl + h] (& select search current project) to find & replace
    > any references to the old path with the new one.
    > * [alt + F4] to close the VB Editor, and save your file.
    >
    > Hopefully, now when you reopen your file the custom buttons will be
    > assigned correctly.
    >
    > hth
    > Rob Brockett
    > NZ
    > Always learning & the best way to learn is to experience...
    >
    >
    > --
    > broro183
    > ------------------------------------------------------------------------
    > broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
    > View this thread: http://www.excelforum.com/showthread...hreadid=544046
    >
    >


  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    howdy,
    Thanks for the feedback, I'm pleased I could help.

    Rob Brockett
    NZ
    Always learning & the best way to learn is to experience...

+ 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