alt+F11 组合键打开VBA窗口, 双击左侧“工程资源管理器”窗口的“ThisDocument”,在弹窗中键入以下代码
Sub PicCenter()Dim myS As InlineShapeApplication.ScreenUpdating = FalseFor Each myS in ActiveDocument.InlineShapesIf Len(myS.Range.Paragraphs(1).Range.Text) = 2 ThenmyS.Range.Paragraphs.Alignment = wdAlignParagraphCenterEnd IfNextApplication.ScreenUpdating = True
End Sub
按F5键执行即可