Shapes.AddOLEControl Method 

Creates an ActiveX control (formerly known as an OLE control). Returns the Shape object that represents the new ActiveX control.

Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in microsoft.office.interop.word.dll)

Usage

Dim ClassType As Object
Dim Left As Object
Dim Top As Object
Dim Width As Object
Dim Height As Object
Dim Anchor As Object
Dim returnValue As Shape
Dim shapes1 As Shapes
returnValue = shapes1.AddOLEControl(ClassType, Left, Top, Width, Height, Anchor)

Syntax

Function AddOLEControl( _
    <InAttribute()> Optional ByRef ClassType As Object, _
    <InAttribute()> Optional ByRef Left As Object, _
    <InAttribute()> Optional ByRef Top As Object, _
    <InAttribute()> Optional ByRef Width As Object, _
    <InAttribute()> Optional ByRef Height As Object, _
    <InAttribute()> Optional ByRef Anchor As Object _
) As Shape
Shape AddOLEControl(
    [In, Optional] ref object ClassType, 
    [In, Optional] ref object Left, 
    [In, Optional] ref object Top, 
    [In, Optional] ref object Width, 
    [In, Optional] ref object Height, 
    [In, Optional] ref object Anchor
);
public: Shape^ AddOLEControl(
    &Object^ ClassType, 
    &Object^ Left, 
    &Object^ Top, 
    &Object^ Width, 
    &Object^ Height, 
    &Object^ Anchor
);
public Shape AddOLEControl(
    /*in*/System.Object ClassType, 
    /*in*/System.Object Left, 
    /*in*/System.Object Top, 
    /*in*/System.Object Width, 
    /*in*/System.Object Height, 
    /*in*/System.Object Anchor
);
function AddOLEControl(
     ClassType : Object, 
     Left : Object, 
     Top : Object, 
     Width : Object, 
     Height : Object, 
     Anchor : Object
) : Shape;

Parameters

  • ClassType
    Optional Object. The programmatic identifier for the ActiveX control to be created.
  • Left
    Optional Object. The position (in points) of the left edge of the new object relative to the anchor.
  • Top
    Optional Object. The position (in points) of the upper edge of the new object relative to the anchor.
  • Width
    Optional Object. The width of the ActiveX control, in points.
  • Height
    Optional Object.The height of the ActiveX control, in points.
  • Anchor
    Optional Object. 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.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

See Also

Reference

Shapes Interface
Microsoft.Office.Interop.Word Namespace

Other Resources

Shapes Members