开发者

collect list/folder of linked workbooks in Excel 2010

I have a workbook which links to a number of other workbooks, which in turn are linked to other workbooks. Is there a simple way to collect all the workbooks referenced by a currently open workbook? I can imagine coding a macro to look at all the cells that hold formulas in a workbook, checking for anything in brackets in the formulas and copying these to a list, but t开发者_JAVA技巧his seems unwieldy and hopefully unnecessary. Does Excel have any tools that help track the workbooks to which a file is linked? I know "trace precedents" is useful within a workbook, and the key combination "ctrl+[" is useful to track linked data, but I can't do this manually for all the cells in the workbook. Thanks for your help.


This code will give you the same list that you'd get by clicking Edit>Links.

Sub PrintLinkedBooks()

Dim LinkedBooks As Variant
Dim i As Long

LinkedBooks = ThisWorkbook.LinkSources()
For i = LBound(LinkedBooks) To UBound(LinkedBooks)
    Debug.Print LinkedBooks(i)
Next i

End Sub

There are also tools out there to find links. I've never used and but Bill Manville's is one that's recommended.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜