Add Method (OLEObjects Collection) Example

The following example presents a dialog box where you can find an OLEObject object (a bitmap) to add to a RichTextBox control. To try the example, place a CommonDialog and a RichTextBox control on a form, and paste the code into the Declarations section. Run the example and double-click on the control.

Private Sub RichTextBox1_DblClick()
   With CommonDialog1
      .Filter = ("bitmap (*.bmp)|*.bmp")
      .ShowOpen
   End With
   RichTextBox1.OLEObjects. _
   Add , , CommonDialog1.filename
End Sub