Link to home
Start Free TrialLog in
Avatar of andrewgrbailey
andrewgrbaileyFlag for United States of America

asked on

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

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
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Set mdlnewdoc = mdlappword.Documents.Add
   mdlnewdoc.Select

mdlappword.Selection.InlineShapes.AddPicture FileName:= _
        "C:\junk\toc\andrew.bmp" _
        , LinkToFile:=False, SaveWithDocument:=True
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial