WorkbookBase.LinkInfo(String, XlLinkInfo, Object, Object) 메서드

정의

연결 날짜와 업데이트 상태를 가져옵니다.

public object LinkInfo (string name, Microsoft.Office.Interop.Excel.XlLinkInfo linkInfoArgument, object type, object editionRef);
member this.LinkInfo : string * Microsoft.Office.Interop.Excel.XlLinkInfo * obj * obj -> obj
Public Function LinkInfo (name As String, linkInfoArgument As XlLinkInfo, Optional type As Object, Optional editionRef As Object) As Object

매개 변수

name
String

링크의 이름입니다.

linkInfoArgument
XlLinkInfo

반환할 정보 형식을 지정하는 XlLinkInfo 값 중 하나입니다.

type
Object

정보를 반환할 해당 링크 형식을 지정하는 XlLinkInfoType 값 중 하나입니다.

editionRef
Object

링크가 버전인 경우 이 매개 변수는 버전 참조를 R1C1 형식의 문자열로 지정합니다. EditionRef 은 통합 문서에 이름이 같은 게시자 또는 구독자가 두 개 이상 있는 경우 필요합니다.

반환

링크에 대한 정보를 나타내는 값입니다. LinkInfoArgumentxlUpdateState인 경우, 이 메서드는 링크가 자동으로 업데이트되면 1을 반환하고 링크를 수동으로 업데이트해야 하면 2를 반환합니다.

예제

다음 코드 예제에서는 현재 통합 문서의 DDE/OLE 링크 컬렉션을 가져오고 메서드를 사용하여 LinkInfo 각 DDE/OLE 링크가 자동으로 또는 수동으로 업데이트되는지 여부를 확인합니다.

이 예제는 문서 수준 사용자 지정을 위한 것입니다.

private void WorkbookLinkInfo()
{
    // Get the collection of DDE/OLE links in the workbook.
    Array links = (Array)this.LinkSources(Excel.XlLink.xlOLELinks);

    // If there are DDE/OLE links, then display how each link
    // updates.
    if (links != null)
    {
        for (int i = 1; i <= links.Length; i++)
        {
            string linkName = (string)links.GetValue(i);
            int updateValue = (int)this.LinkInfo(linkName,
                Excel.XlLinkInfo.xlUpdateState,
                Excel.XlLinkInfoType.xlLinkInfoOLELinks);

            if (updateValue == 1)
            {
                MessageBox.Show(linkName + " link updates automatically.");
            }
            else if (updateValue == 2)
            {
                MessageBox.Show(linkName + " link updates manually.");
            }
        }
    }
    else
    {
        MessageBox.Show("The workbook contains no DDE/OLE links.");
    }
}
Private Sub WorkbookLinkInfo()
    ' Get the collection of DDE/OLE links in the workbook.
    Dim Links As Array = _
        CType(Me.LinkSources(Excel.XlLink.xlOLELinks),  _
        Array)

    ' If there are DDE/OLE links, then display how each link
    ' updates.
    If Links IsNot Nothing Then
        Dim i As Integer
        For i = 1 To Links.Length
            Dim UpdateValue As Integer = Me.LinkInfo(Links(i), _
                Excel.XlLinkInfo.xlUpdateState, _
                Excel.XlLinkInfoType.xlLinkInfoOLELinks)

            If UpdateValue = 1 Then
                MsgBox(Links(i) & " link updates automatically.")
            ElseIf UpdateValue = 2 Then
                MsgBox(Links(i) & " link updates manually.")
            End If
        Next i
    Else
        MsgBox("The workbook contains no DDE/OLE links.")
    End If
End Sub

설명

선택적 매개 변수

선택적 매개 변수에 대한 자세한 내용은 Office 솔루션의 선택적 매개 변수를 참조하세요.

적용 대상