ChangeLink Method

Applies To

Workbook object.

Description

Changes a link from one document to another.

Syntax

expression.ChangeLink(Name, NewName, Type)

expression Required. An expression that returns a Workbook object.

Name Required String. The name of the Microsoft Excel or DDE/OLE link to be changed, as it was returned from the LinkSources method.

NewName Required String. The new name of the link.

Type Optional Variant. The link type. Can be one of the following XlLinkType constants: xlLinkTypeExcelLinks or xlLinkTypeOLELinks. The default value is xlLinkTypeExcelLinks. Use xlLinkTypeOLELinks for both DDE and OLE links.

Example

This example changes a Microsoft Excel link.

ActiveWorkbook.ChangeLink "c:\excel\book1.xls", _
    "c:\excel\book2.xls", xlExcelLinks