Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
More header help, please? IncludePicture with mailmerge | Mailmerge | |||
IncludePicture breaks in Word 2K3 | Mailmerge | |||
How to control image size using nested INCLUDEPICTURE field | Mailmerge | |||
Nested IncludePicture troubles in header table | Page Layout | |||
includepicture From URL + Mergefield | Mailmerge |