#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Saj Saj is offline
external usenet poster
 
Posts: 1
Default includepicture

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
--
w
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default includepicture

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

"Saj" wrote in message
...
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
--
w



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
More header help, please? IncludePicture with mailmerge Earl B Mailmerge 1 April 18th 06 06:38 PM
IncludePicture breaks in Word 2K3 Tricia Turner Mailmerge 3 June 2nd 05 09:10 PM
How to control image size using nested INCLUDEPICTURE field 2dogs Mailmerge 1 May 11th 05 11:44 AM
Nested IncludePicture troubles in header table Birgit Page Layout 7 March 1st 05 08:20 AM
includepicture From URL + Mergefield Thomas Mailmerge 1 February 18th 05 09:05 AM


All times are GMT +1. The time now is 08:17 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"