Skip to content

Add Find Pictures And Report Counts #1

@AlexHedley

Description

@AlexHedley
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions