+ Reply to Thread
Results 1 to 5 of 5

Updating macro links

  1. #1
    Registered User
    Join Date
    05-20-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    33

    Updating macro links

    Hi,

    I have a spreadsheet that links data in from others.
    I currently have a button with a macro assigned that updates the links when pressed.
    Each new week, I have to edit the links to look at the next weekly sheets.
    At present I have to manually edit the links in the macro also.
    Could it be rewritten to update any links in the sheet, without having to specify each link in the macro, like an update all command?

    Thanks for any assistance.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Updating macro links

    Could you share the code and the workbook that you are currently using? We might just need to tweak it a lil.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-20-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    33

    Re: Updating macro links

    Hi,

    Thanks for the quick reply.
    I'm not back at work until Sunday now, and the spreadsheet is on my work laptop.

    The code was created by recording the macro.
    I just started recording and then manually updated the links using edit, links, selecting the links, pressing update values and then stopping the recording.

    This means that the code actually contains the full file path of each link, which changes each week.

    What I'm hoping is possible, is for there to be a piece of code which can update any/all links, without having to have the link in the code itself. (Some sort of update-all command)

    This way, each new week, I can open the spreadsheet and use edit, links, change links- and not also have to manual edit the macro.

    Sorry for the long winded explanation, I think it makes sense?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Updating macro links

    I was doing some testing at my end with some dummy workbooks. I found that even though the 2 other workbooks (book2 and book3) linked to my main file (book1) were closed, when i opened the main book, i got a Enable Content option on the main book and this automatically changed the values.
    Does this happen in your case?

    I didnt find any update all option and i dont think this is possible without feeding the code the appropriate links. If the first option doesnt work, maybe we can help you out in customizing the code so that it automatically locates the file the following week / month? Like maybe the file is saved in a particular format which the code can locate by incrementing the values automatically,etc.

  5. #5
    Registered User
    Join Date
    05-20-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    33

    Re: Updating macro links

    Hi,

    Thanks again for the help.
    Yes, when I open the workbook, the automatic ' Update links' pop up appears, as it should with any workbook that contains external links.

    When I get back to work, I will grab the code and post it here.

    Once again, many thanks for the help.


+ 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