Finding Excel files with external links


New Member
Apr 9, 2018
My administrative department has a bunch of Excel files with links to other Excel files in a variety of network folders. They want (need) to move the files to a new server. I'm thinking that if they move to the new server, all of the links will be severed and they'll need to re-link them manually.

I have two questions:
  1. Is there a way to survey the network file structure and determine the excel files that contain external links?
  2. Is there a way to "automatically" update the external link paths so that the links work after moving to the new server?

Thanks in advance,



Well-known Member
Oct 17, 2005
Office Version
Hi JB,
if the files are moved from e.g. C:\ThisDirectory\ to N:\ThatDirectory\ , that will probably break the links between files. What you could do is create a macro that loops through the directories and opens every Excel file it encounters, modifies the links and closes/saves the file. I don't know how many files you're talking about, but that might take a while. On the other hand, that would save the users quite a lot of manual work&mistakes :).
I don't know how your VBA is, but it could be worth hiring somebody for the job if it's lots of files and/or teaching yourself VBA. Find some code added that can list all files in a directory and directories below it (all levels).

Based on
Public Sub NonRecursiveMethod()
    Dim fso, oFolder, oSubfolder, oFile, queue As Collection
    Dim ResultArray() As String
    Dim n As Long
    Set ResultSheet = Worksheets("MySheetName")
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set queue = New Collection
    queue.Add fso.GetFolder("C:\Users\MyUser\MyDirectory\") 'obviously replace

    n = 1
    ReDim Preserve ResultArray(1 To 3, 1 To n)
    ResultArray(1, n) = "Path"
    ResultArray(2, n) = "FileName"
    ResultArray(3, n) = "LastModified"
    Do While queue.Count > 0
        Set oFolder = queue(1)
        queue.Remove 1 'dequeue
        '...insert any folder processing code here...
        For Each oSubfolder In oFolder.SubFolders
            queue.Add oSubfolder 'enqueue
        Next oSubfolder
        For Each oFile In oFolder.Files
            '...insert any file processing code here...
            If InStr(oFile.Name, ".xls") Then
                n = n + 1
                ReDim Preserve ResultArray(1 To 3, 1 To n)
                ResultArray(1, n) = oFolder.Path
                ResultArray(2, n) = oFile.Name
                ResultArray(3, n) = oFile.DateLastModified
                'Debug.Print oFolder.Path, oFile.Name, oFile.DateLastModified
            End If
        Next oFile

    ResultSheet.Range("A1").Resize(UBound(ResultArray, 2), UBound(ResultArray, 1)).Value = Application.Transpose(ResultArray)
    MsgBox "Found " & n - 1 & " files", vbOKOnly
End Sub

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...