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 / Mailmerge and Fax / August 2006

Tip: Looking for answers? Try searching our database.

includepicture

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Saj - 03 Aug 2006 14:46 GMT
Hi guys, I have an issue where as I am importing picture data which is not in
any standard size, i wish this size to be standard in the template. I have a
command in my document useing the following {includepicture "c://pics/1.jpg"}
i need this a subsequet picture to all be the same size - note graphic name
supplied is changed per record.

thanks
Signature

w

Peter Jamieson - 04 Aug 2006 12:44 GMT
It seems to be fairly easy to ensure that pictures are always reduced to a
certain size (e.g. the INCLUDEPICTURE field in an old-style Word Frame that
is the maximum size you want, then merge to a new document, then select the
document using control-A, then update the images using F9. You probably need
to remove any \*MERGEFORMAT switch in the INCLUDEPICTURE field.

However, that does not increase the size of pictures that are smaller than
the frame. To make all the pictures the same size,
a. you do not need the Frame
b. merge to a new document then run the following macro.

Sub adjustpictures()
 Dim objShape As Word.InlineShape
 Dim intWidth As Integer
 DIm intHeight As Integer
 ' Set these to the values you want
 intWidth = 100
 intHeight = 60
 ActiveDocument.Fields.Update
 For Each objShape In ActiveDocument.InlineShapes
   objShape.Width = intWidth
   objShape.Height = intHeight
 Next
End Sub

Unfortunately, that will distort any image whose sides are not in the ratio
100:60 so you could try the following to pick up the existing ratio for each
image:

Sub adjustpictures()
 Dim objShape As Word.InlineShape
 Dim dblSourceWidth As Double
 Dim dblSourceHeight As Double
 Dim dblTargetWidth As Double
 Dim dblTargetHeight As Double
 Dim dblWidthRatio As Double
 Dim dblHeightRatio As Double
 ' Set these to the maximum values you want
 dblTargetWidth = 100
 dblTargetHeight = 60
 ActiveDocument.Fields.Update
 For Each objShape In ActiveDocument.InlineShapes
   dblSourceWidth = objShape.Width
   dblWidthRatio = dblSourceWidth / dblTargetWidth
   dblSourceHeight = objShape.Height
   dblHeightRatio = dblSourceHeight / dblTargetHeight
   If dblWidthRatio > dblHeightRatio Then
     objShape.Width = CInt(dblTargetWidth)
     objShape.Height = CInt(dblTargetWidth * (dblSourceHeight /
dblSourceWidth))
   Else
     objShape.Height = CInt(dblTargetHeight)
     objShape.Width = CInt(dblTargetHeight * (dblSourceWidth /
dblSourceHeight))
   End If
 Next
End Sub

Peter Jamieson

> Hi guys, I have an issue where as I am importing picture data which is not
> in
[quoted text clipped - 7 lines]
>
> thanks
 
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.