How to Add a Picture in Word VB6

Written by jim campbell
  • Share
  • Tweet
  • Share
  • Email

The Word Visual Basic 6 (VB6) compiler lets you insert pictures using your code instead of requiring a user to manually insert a picture. The Word VB6 code uses a picture located on the hard drive and inserts the picture into the document. You use the "AddPicture" function to insert the picture from VB6.

Skill level:

Other People Are Reading


  1. 1

    Click the Windows "Start" button and type "word" in the search text box. Press "Enter" to open the Word software.

  2. 2

    Press the "Ctrl" and the "O" keys and double-click your Word document in the dialogue window. Click the "Developer" ribbon tab, then click the "Visual Basic" icon to open the code file.

  3. 3

    Copy and paste the following code into the VB editor:

    Dim dialogue As Word.Dialog

    dialog.ActiveDocument.InlineShapes.AddPicture Filename:="c:\image.jpg", LinkToFile:=False, SaveWithDocument:=True, Range:=Selection.Range

    Replace the "c:\image.jpg" with your own image file.

  4. 4

    Click the "Save" button. Click "Run" in the VB editor to test the new settings.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.