I can use Save Picture to save a picture box's picture into a BMP file. Is it possible to save it into a .DOC file with the picture in it?
Printable View
I can use Save Picture to save a picture box's picture into a BMP file. Is it possible to save it into a .DOC file with the picture in it?
Sure thing:
VB Code:
Private Sub Command1_Click() Dim objWord As New Word.Application Dim objDoc As Word.Document Dim strTempFile As String strTempFile = "C:\MyFile.bmp" If Len(Dir(strTempFile)) Then Kill strTempFile SavePicture Picture1.Image, strTempFile objWord.DisplayAlerts = wdAlertsNone Set objDoc = objWord.Documents.Add objDoc.Shapes.AddPicture FileName:=strTempFile, SaveWithDocument:=True Kill strTempFile objDoc.SaveAs "C:\MyFile.doc", wdFormatDocument objWord.Quit End Sub