OLEFormat.Object property (Word)

Returns an Object that represents the specified OLE object's top-level interface. .

Syntax

expression.Object

expression An expression that returns an 'OLEFormat' object.

Remarks

This property allows you to access the properties and methods of an ActiveX control or the application in which an OLE object was created. The OLE object must support OLE Automation for this property to work.

Example

This example sets the value of the first shape on the active document. For the example to work, this first shape must be an ActiveX control (for example, a check box or an option button).

With ActiveDocument.Shapes(1).OLEFormat 
 .Activate 
 Set myObj = .Object 
End With 
myObj.Value = True

This example adds a new ActiveX control to the active document. The example then activates the new option button and sets some of its properties.

Set myOB = ActiveDocument.Shapes _ 
 .AddOLEControl(ClassType:="Forms.OptionButton.1") 
With myOB.OLEFormat 
 .Activate 
 Set myObj = .Object 
End With 
With myObj 
 .Value = False 
 .Caption = "My Caption" 
 .AutoSize = True 
End With

See also

OLEFormat Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.