Forum Discussion

Sharadratra's avatar
Sharadratra
Copper Contributor
Aug 26, 2022

Update linked file in word document

Hi All,

 I need your desperate help please...
Basically I have a word file which contains number  of tables which are linked with a file from 2021. Now I want to update the links from 2021 file to 2022 but unlike excel where we can do this swiftly (using change link), there is no option for such a bulk change in word. Meaning I will have to change the linking of each data item in that word table 😞
I am sure there got to be a way but couldn't find one...

Thanks as always 😊

  • Sharadratra If the change to be made to each link is to replace 2021 with 2022, you could use a macro containing the following code

     

    Dim afld As Field
    With ActiveDocument
        For Each afld In .Fields
            If afld.Type = wdFieldLink Then
                afld.Code.Text = Replace(afld.Code.Text, "2021", "2022")
            End If
        Next afld
    End With

Resources