use the LINKSOURCES() method to identify the links then for each link, use
the CHANGELINK method top alter it.
this will get you started:
Sub Macro1()
' decalre & set the new directory letter
Const NewDIR As String = "X"
Dim alinks, i As Integer
'load link sources into an array
alinks = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(alinks) Then
For i = LBound(alinks) To UBound(alinks)
' just to check, you can delete the msgbox row
MsgBox "Link " & i & ":" & Chr(13) & alinks(i)
ActiveWorkbook.ChangeLink Name:=alinks(i), _
NewName:=NewDIR & Mid(alinks(i), 2), Type:=xlExcelLinks
Next i
End If
End Sub
This code will look for excel links and change for example
D:\Excel\linkB.xls
to
X:\Excel\linkB.xls
--
Patrick Molloy
Microsoft Excel MVP
----------------------------------
Quote:
> Hi Everyone,
> We are looking to migrate from NT to Win2K. We have a lot
> of excel and word spreadsheets with links to network
> shares, or UNC paths. We are looking for a tool or
> automated way to point these embedded links to the new
> drive letter or server name as the data is migrated.
> Does anyone know of a tool that will do this??
> Thanx in advance.