View Single Post
 
Old 03-02-2016, 05:27 AM
PRA007's Avatar
PRA007 PRA007 is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default Working with Ishapes

Why this code fails:

Code:
Sub demo()
'works fine
Application.ScreenUpdating = False
Dim iShp As InlineShape
For Each iShp In ActiveDocument.InlineShapes
  With iShp.Range
            If iShp.Height > 6 Then
              iShp.LockAspectRatio = True
              iShp.Height = InchesToPoints(6)
                  If .Hyperlinks.Count = 1 Then
                    .Hyperlinks(1).Delete
                  End If
            End If
            If iShp.Width > 4 Then
              iShp.LockAspectRatio = True
              iShp.Width = InchesToPoints(4)
              If .Hyperlinks.Count = 1 Then
                  .Hyperlinks(1).Delete
              End If
            End If
  End With
Next
Application.ScreenUpdating = False
End Sub
I want to resize images in the document based on the logic that

1) if the hight of the shape is > 6, make it to 6.

2) if the width of the shape is > 4, make it to 4.

In above code irrespective of size of the shape it executes the code.
Reply With Quote