This documentation is archived and is not being maintained.

Workbook.LinkSources Method

Office 2007
Returns an array of links in the workbook. The names in the array are the names of the linked documents, editions, or DDE or OLE servers. Returns Empty if there are no links.

Syntax

expression.LinkSources(Type)

expression   A variable that represents a Workbook object.

Parameters

NameRequired/OptionalData TypeDescription
TypeOptionalVariantOne of the constants of XlLink which specifies the type of link to return.

Return Value
Variant

Remarks

The format of the array is a one-dimensional array for all types but publisher and subscriber. The returned strings contain the name of the link source, in the appropriate notation for the link type. For example, DDE links use the "Server|Document!Item" syntax.

For publisher and subscriber links, the returned array is two-dimensional. The first column of the array contains the names of the edition, and the second column contains the references of the editions as text.

Example

This example displays a list of OLE and DDE links in the active workbook. The example should be run on a workbook that contains one or more linked Word objects.

Visual Basic for Applications
aLinks = ActiveWorkbook.LinkSources(xlOLELinks)
If Not IsEmpty(aLinks) Then
    For i = 1 To UBound(aLinks)
        MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
    Next i
End If



Show: