Share via


WorkbookBase.LinkInfo 메서드

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

네임스페이스:  Microsoft.Office.Tools.Excel
어셈블리:  Microsoft.Office.Tools.Excel.v4.0.Utilities(Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

구문

‘선언
Public Function LinkInfo ( _
    name As String, _
    linkInfoArgument As XlLinkInfo, _
    type As Object, _
    editionRef As Object _
) As Object
public Object LinkInfo(
    string name,
    XlLinkInfo linkInfoArgument,
    Object type,
    Object editionRef
)

매개 변수

  • editionRef
    형식: System.Object
    링크가 버전인 경우 이 매개 변수는 버전 참조를 R1C1 형식의 문자열로 지정합니다.EditionRef는 통합 문서에 동일한 이름의 게시자 또는 구독자가 둘 이상인 경우에 필요합니다.

반환 값

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

설명

선택적 매개 변수

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

예제

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

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

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
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,
                missing);

            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.");
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

WorkbookBase 클래스

Microsoft.Office.Tools.Excel 네임스페이스