Links
For Each objField In ActiveDocument.Fields
objField.LinkFormat.BreakLink
Next objField
Public Sub TestThis()
Call changeSource("", "")
End Sub
Public Sub changeSource(ByVal sOldFileName As String, _
ByVal sNewFileName As String)
Dim icount As Integer
Dim iloop As Integer
Dim sfilename As String
On Error GoTo ErrorHandler
icount = ActiveDocument.Fields.Count
For iloop = 1 To icount
If (ActiveDocument.Fields(iloop).Type = wdFieldLink) Then
Debug.Print ActiveDocument.Fields(iloop).OLEFormat.ClassType
Debug.Print ActiveDocument.Fields(iloop).OLEFormat.Label
Debug.Print ActiveDocument.Fields(iloop).OLEFormat.DisplayAsIcon
sfilename = ActiveDocument.Fields(iloop).LinkFormat.SourceFullName
ActiveDocument.Fields(iloop).LinkFormat.SourceFullName = _
Replace(sfilename, sOldFileName, sNewFileName)
End If
Next iloop
Exit Sub
ErrorHandler:
Call MsgBox(Err.Number & " - " & Err.Description)
End Sub
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev