1. An OLE control is inserted into the form but when Insert Object dialog box appears it is neglected by pressing the “Cancel” Button.

2. An Insert menu is added to the form with one item in it i.e. Insert Object.

3. In click event handler Insert objDIG method is called using following syntax.




1. Add on OLE control, OLE, to a form now, and click Cancel when the Insert Object dialog box appears.

2. Set the OLE control’s Size Mode property to VBOLESize (note that when programmer set an OLE control’s SizeMode property to VbOLESize AutoSize, the OLE control, OLE1, will probably change when the object is inserted).

3. Finally, add an Insert menu to the form with one item in it: Insert Object.

4. When users click the Insert Object menu item, they want to insert an OLE object in OLE1, and so add the following code.

Private Sub InsertObject-Click ()

OLE.Insert ObjDIG


End Sub

To make sure the OLE insertion operation has complete successfully. The OLE control’s OLEType property is checked, if there’s an OLE object in OLE1. This property can take the value VbOLENone, to indicate to the user that there was an error:

Private Sub InsertObject-Click ()


If OLE1.OLETypes= VbOLENone Then

Msg Box “OLE operation failed”

End If

End Sub


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s