Word – 批量调整图片版式(浮为文字上方)的宏代码
代码一(已测试)
Sub 浮于文字上方()
Dim oShape As Variant, tu As Shape, i
Application.ScreenUpdating = False '关闭屏幕更新
On Error Resume Next
'调整嵌入图形为浮于文字上方,并旋转90度
For Each oShape In ActiveDocument.InlineShapes
Set oShape = oShape.ConvertToShape
ActiveDocument.InlineShapes(i).Select
With oShape
.WrapFormat.Type = 3' (去除.Zorder行 .WrapFormat.Type = shapeType四周形 .WrapFormat.Type = wdWrapTight紧密形 改为.ConvertToInlineShape嵌入形)
.ZOrder 4 '4浮于文字上方 5衬于下方
.Rotation = -90#
End With
Next
'调整其它图形为浮于文字上方,并旋转90度
For Each tu In ActiveDocument.Shapes
ActiveDocument.Shapes(i).Select
With tu
.WrapFormat.Type = 3 ' (去除.Zorder行 .WrapFormat.Type = shapeType四周形 .WrapFormat.Type = wdWrapTight紧密形 改为.ConvertToInlineShape嵌入形)
.ZOrder 4 '4浮于文字上方 5衬于下方
.Rotation = -90#
End With
Next
Application.ScreenUpdating = True '恢复屏幕更新
End Sub
代码二(已测试)
Sub 浮于文字上方()
Dim oShape As Variant, i
Application.ScreenUpdating = False '关闭屏幕更新
On Error Resume Next
For Each oShape In ActiveDocument.InlineShapes
Set oShape = oShape.ConvertToShape
ActiveDocument.InlineShapes(i).Select '选中图片
With oShape
.ZOrder 4 '选中图片版式调为浮于文字上方
.Rotation = -90# '选中图片向左旋转90度
End With
Next
Application.ScreenUpdating = True '关闭屏幕更新
End Sub