1、Sub 图片对齐() .1Sub 图片大小() .1Sub 浮于文字上方() .3Sub 浮于文字上方() .3Sub 连续() .4Sub 版式转换() .4Sub 图片方向() .5Sub 图片对齐()Application.ScreenUpdating = False 关闭屏幕更新Dim nOn Error Resume NextFor n = 1 To ActiveDocument.Shapes.CountActiveDocument.Shapes(n).SelectSelection.ShapeRange.RelativeHorizontalPosition = _wdRelativ
2、eHorizontalPositionMarginSelection.ShapeRange.RelativeVerticalPosition = _wdRelativeVerticalPositionMarginSelection.ShapeRange.Left = wdShapeRightSelection.ShapeRange.Top = wdShapeBottomSelection.ShapeRange.LockAnchor = FalseSelection.ShapeRange.LayoutInCell = TrueSelection.ShapeRange.WrapFormat.All
3、owOverlap = FalseSelection.ShapeRange.WrapFormat.Side = wdWrapBothNextApplication.ScreenUpdating = True 恢复屏幕更新End SubSub 图片大小()On Error Resume NextDim mywidthDim myheightApplication.ScreenUpdating = False 关闭屏幕更新mywidth = Val(InputBox(Prompt:=“单位为厘米(cm); 如果输入为 0,则图片保持原始纵横比,宽度根据输入的高度数值自动调整;“, Title:=“
4、请输入图片宽度“, Default:=“0“) * 28.35myheight = Val(InputBox(Prompt:=“单位为厘米(cm); 如果输入为 0,则图片保持原始纵横比,高度根据输入的宽度数值自动调整;“, Title:=“请输入图片高度“, Default:=“0“) * 28.35-调整嵌入式图形Dim pic As InlineShapeFor Each pic In ActiveDocument.InlineShapesIf mywidth = “0“ Thenpic.Height = myheightpic.ScaleWidth = pic.ScaleHeightE
5、lseIf myheight = “0“ Thenpic.Width = mywidthpic.ScaleHeight = pic.ScaleWidthElsepic.Width = mywidthpic.Height = myheightEnd IfNext调整浮动式图形Dim tu As ShapeFor Each tu In ActiveDocument.ShapesIf mywidth = “0“ Thentu.Height = myheightElseIf myheight = “0“ Thentu.Width = mywidthElsetu.LockAspectRatio = ms
6、oFalsetu.Width = mywidthtu.Height = myheightEnd IfNextApplication.ScreenUpdating = True 恢复屏幕更新End SubSub 浮于文字上方()Dim oShape As Variant, tu As Shape, iApplication.ScreenUpdating = False 关闭屏幕更新On Error Resume Next调整嵌入图形为浮于文字上方,并旋转 90 度For Each oShape In ActiveDocument.InlineShapesSet oShape = oShape.C
7、onvertToShapeActiveDocument.InlineShapes(i).SelectWith oShape.WrapFormat.Type = 3 (去除.Zorder 行 .WrapFormat.Type = shapeType 四周形 .WrapFormat.Type = wdWrapTight 紧密形 改为.ConvertToInlineShape 嵌入形).ZOrder 4 4 浮于文字上方 5 衬于下方 .Rotation = -90#End WithNext调整其它图形为浮于文字上方,并旋转 90 度For Each tu In ActiveDocument.Sha
8、pesActiveDocument.Shapes(i).SelectWith tu.WrapFormat.Type = 3 (去除.Zorder 行 .WrapFormat.Type = shapeType 四周形 .WrapFormat.Type = wdWrapTight 紧密形 改为.ConvertToInlineShape 嵌入形).ZOrder 4 4 浮于文字上方 5 衬于下方.Rotation = -90#End WithNextApplication.ScreenUpdating = True 恢复屏幕更新End SubSub 浮于文字上方()Dim oShape As Var
9、iant, iApplication.ScreenUpdating = False 关闭屏幕更新On Error Resume NextFor Each oShape In ActiveDocument.InlineShapesSet oShape = oShape.ConvertToShapeActiveDocument.InlineShapes(i).Select 选中图片With oShape .ZOrder 4 选中图片版式调为浮于文字上方.Rotation = -90# 选中图片向左旋转 90 度End WithNextApplication.ScreenUpdating = Tru
10、e 关闭屏幕更新End SubSub 连续()Call 浮于文字上方Call 图片大小Call 图片对齐End SubSub 版式转换()Dim oShape As Variant, shapeType As WdWrapTypeOn Error Resume NextIf MsgBox(“Y 将图片由嵌入式转为浮动式,N 将图片由浮动式转为嵌入式“, 68) = 6 ThenshapeType = Val(InputBox(Prompt:=“请输入图片版式 :0=四周型,1=紧密型, “ & vbLf & _“3=衬于文字下方,4=浮于文字上方“, Default:=0)For Each o
11、Shape In ActiveDocument.InlineShapesSet oShape = oShape.ConvertToShapeWith oShapeSelect Case shapeTypeCase 0, 1.WrapFormat.Type = shapeTypeCase 3.WrapFormat.Type = 3.ZOrder 5Case 4.WrapFormat.Type = 3.ZOrder 4Case ElseExit SubEnd Select.WrapFormat.AllowOverlap = FalseEnd WithNextElseFor Each oShape In ActiveDocument.ShapesoShape.ConvertToInlineShapeNextEnd IfEnd SubSub 图片方向()Dim nOn Error Resume NextFor n = 1 To ActiveDocument.Shapes.CountActiveDocument.Shapes(n).IncrementRotation -90#Next nEnd Sub