Word: redimensionar e adicionar borda nas imagens

Abrir VBA:

2: Press Alt+F11 to open the Microsoft Visual Basic for Applications window;
3: Click Module from Insert tab, copy and paste the following VBA code into the Module window;
4: Click Run button to run the VBA

Redimensionar uma por uma:

Sub ResizePics()
Dim shp As Word.Shape
Dim ishp As Word.InlineShape
If Word.Selection.Type <> wdSelectionInlineShape And _
Word.Selection.Type <> wdSelectionShape Then
Exit Sub
End If
If Word.Selection.Type = wdSelectionInlineShape Then
Set ishp = Word.Selection.Range.InlineShapes(1)
ishp.LockAspectRatio = False
ishp.Height = InchesToPoints(1.78)
ishp.Width = InchesToPoints(3.17)
Else
If Word.Selection.Type = wdSelectionShape Then
Set shp = Word.Selection.ShapeRange(1)
shp.LockAspectRatio = False
shp.Height = InchesToPoints(1.78)
shp.Width = InchesToPoints(3.17)
End If
End If
End Sub
 (mudar os números em InchesToPoints(1.78) )

Adicionar borda a todas:

Sub AddBorderToPictures()

    ' Add border to pictures that are "inline with text"
    Dim oInlineShape As InlineShape
    For Each oInlineShape In ActiveDocument.InlineShapes
        oInlineShape.Borders.Enable = True
        oInlineShape.Borders.OutsideColor = wdColorBlack
        oInlineShape.Borders.OutsideLineWidth = wdLineWidth100pt
        oInlineShape.Borders.OutsideLineStyle = wdLineStyleSingle
    Next

    ' Add border to pictures that are floating
    Dim oShape As Shape
    For Each oShape In ActiveDocument.Shapes
        oShape.Line.ForeColor.RGB = RGB(0, 0, 0)
        oShape.Line.Weight = 1
        oShape.Line.DashStyle = msoLineSolid
    Next

End Sub

Fontes:

https://www.extendoffice.com/documents/word/1207-word-resize-all-multiple-images.html
https://stackoverflow.com/questions/38622295/paint-a-border-around-every-image-in-a-word-document

Nenhum comentário:

Postar um comentário

As cotas e a ampla concorrência na UFV

Em agosto de 2012 foi sancionada a Lei 12.711, conhecida popularmente como Lei das Cotas. A partir de então, todas as universidades federai...