Reputation: 57531
As noted in a previous question of mine, Outlook is pasting screen grabs from the Snipping Tool in a default size of 125% x 125%, whereas I'd like it to be 100% x 100%. In lieu of actually changing the default setting, I'd like to make a macro to resize the image.
I've done similar things in VBA PowerPoint, but each application seems to be different. For example, I tried the code
Sub Resize_Outlook4()
With ActiveDocument.InlineShapes(1)
.ScaleHeight = 150
.ScaleWidth = 150
End With
End Sub
following an example from MSDN, which should resize all the inline shapes to 150% x 150%, but this leads to an error "Run-time error '424': Object required".
In short, I'm having trouble specifying an Object which would represent the currently selected picture, or just all the pictures in the e-mail. Does anybody know how to do this correctly?
Upvotes: 1
Views: 6686
Reputation: 53623
I think this should work, but I still recommend simply changing the default settings...
Sub Resize150()
Dim objDoc As Object
Dim shp As Object
'Get the word-editor of the mail item
If Application.ActiveInspector Is Nothing Then Exit Sub
Set objDoc = Application.ActiveInspector.WordEditor
For Each shp In objDoc.InlineShapes
If shp.HasPicture Then
shp.ScaleHeight = 150
shp.ScaleWidth = 150
End If
Next
End Sub
Upvotes: 2