Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Understanding IncludePicture

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Diane - 04 Sep 2007 16:02 GMT
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
Doug Robbins - Word MVP - 05 Sep 2007 10:02 GMT
Insert the image into the cell of a table that has fixed cell dimensions.

Signature

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

>I have a report that pulls a button image from a specified directory, my
> command: {includepicture "C\{mergefield inventory#}.jpg \*mergeformat} -
[quoted text clipped - 10 lines]
> merged report that uses the "includepicture"??
> Thanks, Diane
Diane - 07 Sep 2007 02:04 GMT
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

> Insert the image into the cell of a table that has fixed cell dimensions.
>
[quoted text clipped - 12 lines]
> > merged report that uses the "includepicture"??
> > Thanks, Diane
Doug Robbins - Word MVP - 08 Sep 2007 02:07 GMT
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

Signature

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

> The fixed cell almost works for me, but the image is larger than what I
> would
[quoted text clipped - 29 lines]
>> > merged report that uses the "includepicture"??
>> > Thanks, Diane
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.