Results 1 to 2 of 2

Thread: Save pictures into .DOC

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2001
    Posts
    57

    Save pictures into .DOC

    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?

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Sure thing:
    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim objWord As New Word.Application
    3.     Dim objDoc As Word.Document
    4.     Dim strTempFile As String
    5.    
    6.     strTempFile = "C:\MyFile.bmp"
    7.     If Len(Dir(strTempFile)) Then Kill strTempFile
    8.     SavePicture Picture1.Image, strTempFile
    9.    
    10.     objWord.DisplayAlerts = wdAlertsNone
    11.     Set objDoc = objWord.Documents.Add
    12.     objDoc.Shapes.AddPicture FileName:=strTempFile, SaveWithDocument:=True
    13.    
    14.     Kill strTempFile
    15.    
    16.     objDoc.SaveAs "C:\MyFile.doc", wdFormatDocument
    17.     objWord.Quit
    18. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width