Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Error 438 when trying to insert a picture into a Word document.

Posted on 2004-10-29
Medium Priority
Last Modified: 2010-05-02
The following code fails on my machine with a 438 error.

I have the Word 10.0 object library referenced.

I can insert text into the document, just not a picture.

Any ideas?

Private Sub Command1_Click()
    Dim mdlappword As Word.Application
    Dim mdlnewdoc As Word.Document
    Set mdlappword = New Word.Application
    Set mdlnewdoc = mdlappword.Documents.Add
    'mdlNewDoc.Shapes.AddPicture filename:=signaturefile, linktofile:=False, Savewithdocument:=True
    test = mdlappword.ActiveDocument.Shapes.AddPicture("C:\junk\toc\andrew.bmp") ', False, True)
    mdlnewdoc.SaveAs "c:\junk\toc\test.doc"
End Sub
Question by:andrewgrbailey
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 26

Expert Comment

ID: 12446425
Set mdlnewdoc = mdlappword.Documents.Add

mdlappword.Selection.InlineShapes.AddPicture FileName:= _
        "C:\junk\toc\andrew.bmp" _
        , LinkToFile:=False, SaveWithDocument:=True

Accepted Solution

modulo earned 0 total points
ID: 12898583
PAQed with no points refunded (of 250)

Community Support Moderator

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question