[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

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

Posted on 2004-10-29
4
Medium Priority
?
157 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
Comment
Question by:andrewgrbailey
2 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12446425
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:
modulo earned 0 total points
ID: 12898583
PAQed with no points refunded (of 250)

modulo
Community Support Moderator
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
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…
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

640 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