This code samples below will let you add an image to the RichTextBox. The first code uses the OLEObject and the
second using the ClipBoard.
Private Sub Command1_Click() Dim sfile As String
sfile = "c:\download\new.bmp"
rtf1.OLEObjects.Add , , sfile
End Sub
'Can be used with the PictureBox or Image Control
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long,_
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_PASTE = &H302
Private Sub Form_Load()
'Load your chosen graphics file into a picturebox or Image control...
Image1.Picture = LoadPicture("g:\oscar.bmp")
'hide it from the user
Image1.Visible = False
End Sub
Private Sub Command1_Click()
' Clear the clipboard
Clipboard.Clear
' Copy Picture into the clipboard.
Clipboard.SetData Image1.Picture
' "Paste" the picture into the RichTextBox,
' using the SendMessage API function
SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0
End Sub