Blog Logo

2025-11-24 ~ 2 min read

Use a macro to change all pictures change their Wrap Text with In line with Text at once


Use a macro to change all pictures change their Wrap Text with In line with Text at once

If you’re okay using a tiny bit of VBA, you can change all pictures in the document in one shot:

  1. Press Alt + F11 to open the VBA editor.

  2. Click Insert → Module.

  3. Paste this code:

    Sub AllPicturesInlineWithText()
        Dim shp As InlineShape
        Dim shpFloat As Shape
    
        ' Convert floating Shapes to InlineShapes
        For Each shpFloat In ActiveDocument.Shapes
            ' Convert only if it's a picture or similar
            If shpFloat.Type = msoPicture Or shpFloat.Type = msoLinkedPicture Or shpFloat.Type = msoLinkedOLEObject Or shpFloat.Type = msoOLEControlObject Then
                shpFloat.ConvertToInlineShape
            End If
        Next shpFloat
    
        ' Ensure all InlineShapes are treated as inline (they already are, but we loop anyway)
        For Each shp In ActiveDocument.InlineShapes
            ' Nothing else needed – inline shapes are already "In line with text"
            ' You could adjust size/other properties here if desired
        Next shp
    End Sub
  4. Close the editor.

  5. Back in Word, press Alt + F8, choose AllPicturesInlineWithText, and click Run.

What this does:

  • Any floating images (those with other wrap styles) are turned into inline images.
  • Inline images are, by definition, In line with text.

⚠️ Before running a macro, make a backup copy of your document, just in case.

removes the Keep lines together setting from every paragraph in the document

Sub RemoveKeepLinesTogether()

    Dim para As Paragraph
    Dim count As Long

    count = 0

    For Each para In ActiveDocument.Paragraphs
        If para.Format.KeepTogether = True Then
            para.Format.KeepTogether = False
            count = count + 1
        End If
    Next para

    MsgBox count & " paragraph(s) updated.", vbInformation

End Sub

Photo of Yinhuan Yuan

Hi, I'm Yinhuan Yuan. I'm a software engineer based in Toronto. You can read more about me on yuan.fyi.