View Single Post
 
Old 01-17-2017, 11:17 AM
Fabulist Fabulist is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Sep 2015
Posts: 33
Fabulist is on a distinguished road
Default Macro to resize all objects & pictures?

Hello everyone!

I have multiple linked pictures and objects (including Excel worksheet objects) and I need to reset all their sizes to 100% after they are updated since they seem to break.

I tried the following macros but none worked:

1:
Code:
Sub Resize()
Dim i As Long
With ActiveDocument
    For i = 1 To .InlineShapes.Count
        With .InlineShapes(i)
            .ScaleHeight = 100
            .ScaleWidth = 100
        End With
    Next i
End With
End Sub
2:
Code:
Sub Resize()
    Dim Slide As InlineShape
    
    For Each Slide In ActiveDocument.InlineShapes
        With Slide
            If .Type = wdInlineShapeEmbeddedOLEObject Then
                .ScaleWidth = 100
                .ScaleHeight = 100
            End If
        End With
    Next
End Sub
3:
Code:
Sub Resize()
     Dim PecentSize As Integer

     PercentSize = 100

     If Selection.InlineShapes.Count > 0 Then
         Selection.InlineShapes(1).ScaleHeight = PercentSize
         Selection.InlineShapes(1).ScaleWidth = PercentSize
     Else
         Selection.ShapeRange.ScaleHeight Factor:=(PercentSize / 100), _
           RelativeToOriginalSize:=msoCTrue
         Selection.ShapeRange.ScaleWidth Factor:=(PercentSize / 100), _
           RelativeToOriginalSize:=msoCTrue
     End If
 End Sub
Am I thinking this in a wrong way? Nothing seems to budge.
Reply With Quote