Sub FindPicturesAndReportCounts()
Dim Pic As InlineShape
Dim TotalPictures As Integer
Dim PicturesWithoutBorder As Integer
Dim Response As VbMsgBoxResult
TotalPictures = 0
PicturesWithoutBorder = 0
For Each Pic In ActiveDocument.InlineShapes
If Pic.Type = wdInlineShapePicture Then
TotalPictures = TotalPictures + 1
If Pic.Line.Visible = False Then
PicturesWithoutBorder = PicturesWithoutBorder + 1
Response = MsgBox("Picture without border found! Do you want to add a 0.5 pt black border?", vbYesNo + vbQuestion, "Confirmation")
If Response = vbYes Then ' Add a 0.5 pt black border to the picture
Pic.Line.Weight = 0.5
Pic.Line.ForeColor.RGB = RGB(0, 0, 0) ' Black color
End If
End If
End If
Next pic
' Report Counts
MsgBox "Total pictures: " & totalPictures & vbCrLf & "Pictures without a border: " & PicturesWithoutBorder, vbInformation, "Counts Report"
End Sub