Problem inserting Pictures in correct location

J

John Renkar

I am usingan Access database to store the name, description, and location of
Pictures that need to be inserted into a Word document. The following code
inserts the pictures, but they all appear at the top of the document in
inverse order instead of where they are supposed to be.

***********************************************
strSQl = "Select *from tblPictures"
Set rs = db.OpenRecordset(strSQl)
Do Until rs.EOF
'Type in name of Picture
Selection.TypeText Text:=rs!PicName
Selection.TypeParagraph
Selection.TypeParagraph
'Insert Picture
P1.InlineShapes.AddPicture rs!PicLocation, LinkToFile:=False,
SaveWithDocument:=True
Selection.TypeParagraph
Selection.TypeParagraph
'Type in description of Picture
Selection.TypeText Text:=rs!PicDescription
Selection.TypeParagraph
Selection.TypeParagraph
rs.MoveNext
Loop
rs.Close
*****************************************

The completed documents show Picture 3 then Picture 2 then Picture 1 then
the names and description.

How do I get the pictures to be placed between the names nd the
descriptions.

Thank youin advance for your help.

John
 
D

Doug Robbins

Hi John,

One sure way to get them in the right place will be to insert a table with
twice as many rows as you have pictures, then place the picture name and the
picture is specific cells of the table, determined by incrementing a
counter.

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top