Visual Basic Reference

CreateLink Method

See Also    Example    Applies To

Creates a linked object from the contents of a file. Doesn't support named arguments.

Syntax

object**.CreateLink**sourcedoc, sourceitem

The CreateLink method syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Sourcedoc Required. The file from which the object is created.
Sourceitem Optional. The data within the file to be linked in the linked object.

Remarks

If you specify values for the arguments of this method, those values override the settings of the SourceDoc and SourceItem properties. Those properties are updated to reflect the argument values when the method is invoked.

When an object is created with this method, the OLE container control displays an image of the file specified by the SourceDoc property. If the object is saved, only the link references are saved because the OLE container control contains only a metafile image of the data and no actual source data.

When you create a new object, the application associated with the class name (for example, Excel.exe) must be correctly registered with the operating system. (The application setup program should register the application correctly.)