SetLinkOnData Method

Applies To

Workbook Object.

Description

Sets the name of a macro or procedure that runs whenever a link is updated.

Syntax

object.SetLinkOnData(name, procedure)

object

Required. The Workbook object.

name

Required. Specifies the name of the Microsoft Excel or DDE/OLE link, as returned from the LinkSources method.

procedure

Optional. Specifies the name of the procedure to run when the link is updated. This can be either a Microsoft Excel version 4.0 macro or a Visual Basic procedure. Set this argument to an empty string ("") to indicate that no procedure should run when the link is updated.

Remarks

Use this method to set notification for a specific link. Use the OnData property if you wish to be notified when any link is updated.

See Also

OnData Property.

Example

This example sets the name of the procedure that runs whenever the DDE link is updated.


ActiveWorkbook.SetLinkOnData "WinWord|'C:\MSGFILE.DOC'!DDE_LINK1", _
    "my_Link_Update_Macro"