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
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