AddOLEControl Method

See Also         Example         Applies To

Shapes object: Creates an ActiveX control. Returns the Shape object that represents the new ActiveX control.

InlineShapes object: Creates an ActiveX control. Returns the InlineShape object that represents the new ActiveX control.

Syntax 1

expression.AddOLEControl(ClassType, Left, Top, Width, Height, Anchor)

Syntax 2

expression.AddOLEControl(ClassType, Range)

expression   Syntax 1: Required. An expression that returns a Shapes object.

Syntax 2: Required. An expression that returns an InlineShapes object.

ClassType   Optional String. The OLE long class name or the programmatic identifier for the ActiveX control to be created.

For information about available ActiveX control class types, see OLE Programmatic Identifiers

Left, Top   Optional Variant. The position (in points) of the upper-left corner of the new object relative to the anchor.

Width, Height   Optional Variant. The width and height of the ActiveX control, in points.

Anchor   Optional Variant. The range to which the ActiveX control is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, however, the anchor is placed automatically and the ActiveX control is positioned relative to the top and left edges of the page.

Range   Optional Variant. The range where the ActiveX control will be placed in the text. The ActiveX control replaces the range, if the range isn't collapsed. If this argument is omitted, the Active X control is placed automatically.

Remarks

ActiveX controls are represented as either Shape objects or InlineShape objects in Word. To modify the properties for an ActiveX control, you use the Object property of the OLEFormat object for the specified shape or inline shape.