Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
adding pictures to the end of a word document?!
Hello,
I've been able to code the following from Excel VBA (2007) 1) open a Word template 2) Update some bookmarks 3) Add pictures from a folder into word However, the picutres are being added at the beginning of the document. After updating the bookmarks, I'd like to go to the end of the document and add the picture. The pictures are tiling on top of each other. I'm not sure why. Here is my current code: mPatientID = wks.Range("c15").Value mExamName = wks.Range("c25").Value lrow = wks.Range("ba1").End(xlDown).Row Set wrdApp = CreateObject("word.application") 'open the template to populate sPath = ThisWorkbook.path & "\" reviewFileLetterSave = sPath & reviewFileLetter Set wrdDoc = wrdApp.Documents.Add(Template:=sPath & _ "formlettertmp.dot") With wrdDoc ..Bookmarks("PatientID").Range.Text = mPatientID ..Bookmarks("ExamName").Range.Text = mExamName For i = 0 To lrow - 1 mComment = wks.Range("bb1").Offset(i, 0).Value mPageName = wks.Range("ba1").Offset(i, 0).Value .Content.InsertAfter mComment .Content.InsertParagraphAfter For x = 1 To 3 imagefile = sFolder & "\images\" & reviewfileName & "_" & mPageName & "_ch" & CStr(x) & ".gif" .Content.InsertParagraphAfter .Content.InlineShapes.AddPicture _ Filename:=imagefile, _ LinkToFile:=False, SaveWithDocument:=True Next x Next i If Dir(reviewFileLetterSave) < "" Then Kill reviewFileLetterSave End If .SaveAs (reviewFileLetterSave) .Close ' close the document End With 'populate the bookmarks ' Set wrdDoc = Nothing 'close word wrdApp.Quit Set wrdApp = Nothing |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do you export pictures from my pictures file into a word docu | New Users to Excel | |||
Integrating pictures in an excel document | Excel Discussion (Misc queries) | |||
Pictures.Visible question (after adding many pictures, they stop disappearing) | Excel Programming | |||
How to get the pictures in my excel document to appear on web vers | Excel Discussion (Misc queries) | |||
How to put pictures into an excel document for merging in Word? | Excel Worksheet Functions |