Skip to content

Instantly share code, notes, and snippets.

@notacouch
Created September 21, 2020 16:34
Show Gist options
  • Save notacouch/e00a09acec69dfebc18c79de2931b356 to your computer and use it in GitHub Desktop.
Save notacouch/e00a09acec69dfebc18c79de2931b356 to your computer and use it in GitHub Desktop.
MS Word Macro: Scale images to 50%
Sub ResizeImagesToHalf()
'
' Source: https://superuser.com/a/941255/172631
'
' .ScaleHeight below was getting the error:
' Run-time error '4693':
' This member cannot be accessed on a horizontal line.
'
' have to check the type of object it seems, source:
' https://answers.microsoft.com/en-us/msoffice/forum/all/fix-for-macro-to-add-borders-to-all-images-in-a/43b255dc-7cca-4df9-8721-1b6135ae6aca
'
' Found relevant object after browsing the object browser forever.
' solution:
' https://www.tek-tips.com/viewthread.cfm?qid=1540552
'
Dim i As Long
With ActiveDocument
For i = 1 To .InlineShapes.Count
With .InlineShapes(i)
If .Type = wdInlineShapePicture Then
.ScaleHeight = 50
.ScaleWidth = 50
End If
End With
Next i
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment