Understanding IncludePicture

D

Diane

I have a report that pulls a button image from a specified directory, my
command: {includepicture "C\{mergefield inventory#}.jpg \*mergeformat} - this
almost works. The two problems that I have are 1) I would like to specify
the size of the box that the image is pulled into. These images are all
buttons, but when the image is pulled into the document, I have a large box
with a small image and now the table is no longer the size that I have
created it to be. Is there a way that I can draw a box and import the button
image into it?? 2) My other problem is when the report merges, I have to
refresh the document to bring in the images? Is this what I expect with a
merged report that uses the "includepicture"??
Thanks, Diane
 
D

Doug Robbins - Word MVP

Insert the image into the cell of a table that has fixed cell dimensions.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Diane

The fixed cell almost works for me, but the image is larger than what I would
like it to be. I've tried inserting a text frame and the includepicture
within that, but then I only get the same picture throughout the table, it
does not update to each "product" image. I've also tried inserting a frame
and then the code within it, but I can't seem to get the frame placed within
the cell.
Any more thoughts??
Diane
 
D

Doug Robbins - Word MVP

You can use code to adjust the size of the image inserted into the cell of a
table.

This is part of a routine that was set up to load various corporate logos
into a cell of a table in the header of a document, and then adjust the size
of the logo so that it fitted in the cell:

'Insert Logo on Title Page
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.Delete
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes.AddPicture Filename:=txtLargeLogoPath
'Adjust size of logo to match avalable space
oheight =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If oheight < InchesToPoints(2) Then
With
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Height = InchesToPoints(2)
.Width = owidth * InchesToPoints(2) / oheight
End With
End If
oheight =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
owidth =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
If owidth > InchesToPoints(2.85) Then
With
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
.Width = InchesToPoints(2.85)
.Height = oheight * InchesToPoints(2.85) / owidth
End With
End If


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

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