andrewgrbailey
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.AddPictu re filename:=signaturefile, linktofile:=False, Savewithdocument:=True
test = mdlappword.ActiveDocument. Shapes.Add Picture("C :\junk\toc \andrew.bm p") ', False, True)
mdlnewdoc.SaveAs "c:\junk\toc\test.doc"
End Sub
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.AddPictu
test = mdlappword.ActiveDocument.
mdlnewdoc.SaveAs "c:\junk\toc\test.doc"
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
mdlnewdoc.Select
mdlappword.Selection.Inlin
"C:\junk\toc\andrew.bmp" _
, LinkToFile:=False, SaveWithDocument:=True