Hello everybody!
I work a lot with Word docs that have a lot of screenshots, so I use this macro to add borders automatically:
Sub AddPictureBorders()
Dim objShape As Shape
Dim objInLineShape As InlineShape
Dim objDoc As Document
Set objDoc = ThisDocument
With objDoc
For Each objInLineShape In .InlineShapes
With objInLineShape.Line
.Style = msoLineSingle
.ForeColor.RGB = RGB(180, 180, 180)
.Weight = 0.5
End With
Next
For Each objShape In .Shapes
objShape.Fill.Solid
With objShape.Line
.Style = msoLineSingle
.ForeColor.RGB = RGB(180, 180, 180)
.Weight = 0.5
End With
Next
End With
End Sub
It works great and really makes it easier. But sometimes I need to paste very small screenshots (let's say, up to 15x15 px) and I don't want to frame them. Unfortunately, this macro affects all the images. I spent a lot of time googling solutions and I found one: macro can ask me "do you want to add a border to this image?", but it doesn't work for me as I have hundreds of them
Is it possible to add a variable like "if an image is bigger than 15x15 px, don't add the border" or something similar? I started to learn VBA just some time ago and I have no idea how to solve it.
Thank you!