Thread: [Solved] Links to other files
View Single Post
 
Old 10-19-2015, 02:56 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,365
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For example:
Code:
Sub Demo()
Dim StrLnks As String, i As Long, aLnks
With ActiveWorkbook
  On Error Resume Next
  aLnks = .LinkSources(xlExcelLinks)
  StrLnks = StrLnks & "Excel Links: "
  For i = 1 To UBound(aLnks)
    StrLnks = StrLnks & vbCr & aLnks(i)
  Next i
  aLnks = .LinkSources(xlOLELinks)
  StrLnks = StrLnks & vbCr & vbCr & "OLE Links: "
  For i = 1 To UBound(aLnks)
    StrLnks = StrLnks & vbCr & aLnks(i)
  Next i
End With
MsgBox StrLnks
End Sub
As coded, the above macro tests the active workbook and simply outputs what it finds to a message box. Getting the data onto a worksheet or output to a text file would be quite easy, but you obviously wouldn't want it overwriting your worksheet data! With some extra code, the process could be made to run against all Excel files in a folder and send the output, including each linking file's name, to a new file (e.g. Excel workbook/text file/Word document).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote