+ Reply to Thread
Results 1 to 5 of 5

Excel Links to Multiple Individual Files Keep Changing Location

  1. #1
    Registered User
    Join Date
    01-21-2016
    Location
    Kirksville, MO
    MS-Off Ver
    MS Office 2010
    Posts
    86

    Question Excel Links to Multiple Individual Files Keep Changing Location

    I have a blanket workbook for vendors that the City I work for to keep track on all the separate purchase orders, their amounts and remaining balance open. I have the files scanned after the purchases and on stored on server designated to our department ("L" drive)(ex. file:///\\ch-fs01\Public_Works\Purchasing\Blank Invoices\2022\walmart po85040 usb for sewer jet.pdf).

    A couple times this year for some reason the links change from the L drive location to "C:\Users\blinhart\AppData\Roaming\Microsoft\Excel" and the name of the linked file remains the same, which of course no longer work since the files are not stored in this folder. (ex. C:\Users\blinhart\AppData\Roaming\Microsoft\Excel\Blanket Invoices\2022\walmart po85040 usb for sewer jet 011822.pdf).

    Is there something I am doing incorrectly when I am inserting each link at the time of each purchase? I am currently right clicking on each cell and inserting the hyperlink, but I fear I may be doing this incorrectly maybe? I tried to save a copy of the "Blanket" file on an external drive in case this happen again since it is very time consuming to repair all the broken links, but that file changed also. Any ideas on how to fix or what I am doing wrong would be greatly appreciated. Thanks

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: Excel Links to Multiple Individual Files Keep Changing Location

    If a link to an off-site location (a different server or drive, for instance), and excel cannot find that destination/source, it will sometimes default to it's own local drive (drive C?)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    01-21-2016
    Location
    Kirksville, MO
    MS-Off Ver
    MS Office 2010
    Posts
    86

    Re: Excel Links to Multiple Individual Files Keep Changing Location

    Ok, I will do some research on this because not sure how to do a VBA code tag. Thanks for the advice.

  4. #4
    Registered User
    Join Date
    11-30-2011
    Location
    Minnesota, USA
    MS-Off Ver
    Excell 2007
    Posts
    6

    Re: Excel Links to Multiple Individual Files Keep Changing Location

    I got the same roaming c drive so I put this in the Macros-it came up run-time error 7 with this line highlighted. xLink.Address = Replace(xLink.Address, OldLink, NewLink) all other sheets worked with code in the workbook except one sheet any suggestion how to fix.
    ub Find_Replace_Hyperlinks()
    Dim xWS As Worksheet
    Dim xLink As Hyperlink
    Dim OldLink As String, NewLink As String
    Box_Title = "Find & Replace Hyperlinks"
    Set xWS = Application.ActiveSheet
    OldLink = Application.InputBox("Input Old Text:", Box_Title, "", Type:=2)
    NewLink = Application.InputBox("Input New Text:", Box_Title, "", Type:=2)
    Application.ScreenUpdating = False
    For Each xLink In xWS.Hyperlinks
    xLink.Address = Replace(xLink.Address, OldLink, NewLink)
    Next
    Application.ScreenUpdating = True
    End Sub
    Last edited by lonadawn; 12-21-2022 at 09:08 AM. Reason: Forgot to add

  5. #5
    Registered User
    Join Date
    11-30-2011
    Location
    Minnesota, USA
    MS-Off Ver
    Excell 2007
    Posts
    6

    Re: Excel Links to Multiple Individual Files Keep Changing Location

    I used this instead, it worked
    Dim h As Hyperlink
    Dim sOld As String
    Dim sNew As String

    sOld = "C:\Users\lmack\AppData\Roaming\Microsoft"
    sNew = "\\newlink"
    For Each h In ActiveSheet.Hyperlinks
    If InStr(1, h.Address, sOld) Then
    h.Address = Replace(h.Address, sOld, sNew)
    End If
    Next h
    End Sub

+ 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. [SOLVED] Changing file links of multiple files at once in SharePoint
    By djbehar in forum Excel General
    Replies: 0
    Last Post: 10-24-2022, 11:44 AM
  2. Replies: 1
    Last Post: 12-20-2014, 03:05 AM
  3. Macro To save multiple Excel sheets to multiple (individual) PDF Files
    By Keith Edgar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-21-2014, 12:51 PM
  4. Importing Multiple individual txt files into one single spreadsheet using 2003 Excel
    By keige123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 10:29 PM
  5. Replies: 2
    Last Post: 10-19-2011, 09:16 PM
  6. Help importing multiple text files to individual sheets in an excel workbook
    By cham.miller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2010, 06:55 PM
  7. [SOLVED] Changing links in many excel files.
    By cghall55 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2005, 02:05 AM

Tags for this Thread

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