WorkbookBase.OpenLinks Method
Opens the supporting documents for a link or links.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
Public Sub OpenLinks ( _
name As String, _
readOnly As Object, _
type As Object _
)
public void OpenLinks(
string name,
Object readOnly,
Object type
)
Parameters
- name
Type: System.String
The name of the Microsoft Office Excel or DDE/OLE link, as returned from the LinkSources method.
- readOnly
Type: System.Object
true to open documents as read-only. The default value is false.
- type
Type: System.Object
One of the XlLink values. The link type.
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example uses the LinkSources method to get an array of the names of all Excel links in the current workbook. The example then uses the OpenLinks method to open each document as read-only.
This example is for a document-level customization.
Private Sub WorkbookLinkSources()
Globals.Sheet1.Range("A1").Value2 = _
"='C:\[Book2.xls]Sheet1'!R2C2"
Dim links As Array = _
CType(Me.LinkSources(Excel.XlLink.xlExcelLinks), _
Array)
Dim i As Integer
For i = 1 To links.Length
Me.OpenLinks(links(i), True, Excel.XlLink.xlExcelLinks)
Next i
End Sub
private void WorkbookLinkSources()
{
Globals.Sheet1.Range["A1", missing].Value2 =
@"='C:\[Book2.xls]Sheet1'!R2C2";
Array links = (Array)this.LinkSources(Excel.XlLink.xlExcelLinks);
for (int i = 1; i <= links.Length; i++)
{
this.OpenLinks((string)links.GetValue(i), true,
Excel.XlLink.xlExcelLinks);
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.