Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you export pictures from my pictures file into a word docu Becky New Users to Excel 1 November 20th 09 07:02 PM
Integrating pictures in an excel document Mag Gam Excel Discussion (Misc queries) 2 March 9th 07 12:53 PM
Pictures.Visible question (after adding many pictures, they stop disappearing) Abe[_4_] Excel Programming 2 July 11th 06 05:02 AM
How to get the pictures in my excel document to appear on web vers michelemcp Excel Discussion (Misc queries) 0 June 26th 06 02:19 PM
How to put pictures into an excel document for merging in Word? PAW Excel Worksheet Functions 1 February 8th 06 05:51 PM


All times are GMT +1. The time now is 07:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"