Picture resizing woes

K

km176351

Hi there,
I have some documents with a lot of different sized pictures in. I a
trying to create a macro that will resize each picture individuall
dependendant on its size. For example any picture over 12.33 cm's i
width should be set to 12.33 cms (350 pts)in width. A smaller pictur
should be set to 100 % scale if it still remains under 12.33 cm's i
width. My macro is sort of working however I cannot get the pictures t
keep there aspect ratio i.e. Not resized proportionaly.

Here is the code:

Dim objDoc As Document
Dim oPic As InlineShape

Set objDoc = ActiveDocument
For Each oPic In objDoc.InlineShapes

oPic.LockAspectRatio = msoTrue
oPic.ScaleWidth = 100
oPic.ScaleHeight = 100
If oPic.Width > 350 Then
oPic.Width = 350
oPic.LockAspectRatio = msoTrue
If oPic.ScaleWidth > 100 Or oPic.ScaleHeight > 100 Then
oPic.ScaleHeight = 100
oPic.ScaleWidth = 100
End If
End If

Next oPi
 
W

Word Heretic

G'day km176351 <[email protected]>,

Impossibly long answer for full functionality but for your purposes
you just need to know that lock aspect is ONLY for the GUI, you have
to set scalewidth and scaleheight despite it.


Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


km176351 was spinning this yarn:
 
M

Mark Tangard

I've never been able to get LockAspectRatio to work either. I just set
single variables to the picture's current length & width, then reassign
the recalculated length & width based on the ratio to the desired size.
 

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