Solved

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

Posted on 2004-10-29
143 Views
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.Select
    '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
0
Question by:andrewgrbailey
    2 Comments
     
    LVL 26

    Expert Comment

    by:EDDYKT
    Set mdlnewdoc = mdlappword.Documents.Add
       mdlnewdoc.Select

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

    Accepted Solution

    by:
    PAQed with no points refunded (of 250)

    modulo
    Community Support Moderator
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Cisco Complete Network Certification Training

    If you’re an IT engineer or technician, it's time you take your career to the next level. This elite training bundle is brimming with all of the information you need to learn to sit for Cisco CNNA, CCNP, and CCENT certification exams.

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    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.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    913 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now