收藏 分销(赏)

用宏批量调整word中图片版式、大小、方向.doc

上传人:a199****6536 文档编号:2667309 上传时间:2024-06-04 格式:DOC 页数:6 大小:47.55KB
下载 相关 举报
用宏批量调整word中图片版式、大小、方向.doc_第1页
第1页 / 共6页
用宏批量调整word中图片版式、大小、方向.doc_第2页
第2页 / 共6页
用宏批量调整word中图片版式、大小、方向.doc_第3页
第3页 / 共6页
用宏批量调整word中图片版式、大小、方向.doc_第4页
第4页 / 共6页
用宏批量调整word中图片版式、大小、方向.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、Sub 图片对齐()1Sub 图片大小()1Sub 浮于文字上方()3Sub 浮于文字上方()3Sub 连续()4Sub 版式转换()4Sub 图片方向()5Sub 图片对齐()Application.ScreenUpdating = False 关闭屏幕更新Dim n On Error Resume Next For n = 1 To ActiveDocument.Shapes.Count ActiveDocument.Shapes(n).Select Selection.ShapeRange.RelativeHorizontalPosition = _ wdRelativeHorizont

2、alPositionMargin Selection.ShapeRange.RelativeVerticalPosition = _ wdRelativeVerticalPositionMargin Selection.ShapeRange.Left = wdShapeRight Selection.ShapeRange.Top = wdShapeBottom Selection.ShapeRange.LockAnchor = False Selection.ShapeRange.LayoutInCell = True Selection.ShapeRange.WrapFormat.Allow

3、Overlap = False Selection.ShapeRange.WrapFormat.Side = wdWrapBoth Next Application.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.ScaleHeightElseIf myheight =

5、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 = msoFalsetu.Width = mywidt

6、htu.Height = myheightEnd IfNext Application.ScreenUpdating = True 恢复屏幕更新End SubSub 浮于文字上方() 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 Acti

7、veDocument.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.

8、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 SubSub 浮于文字上方() Dim oShape As Variant, iApplicati

9、on.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 NextApplication.ScreenUpdating = True 关闭屏幕更新En

10、d SubSub 连续()Call 浮于文字上方Call 图片大小Call 图片对齐End SubSub 版式转换() Dim oShape As Variant, shapeType As WdWrapType On Error Resume Next If MsgBox(Y将图片由嵌入式转为浮动式,N将图片由浮动式转为嵌入式, 68) = 6 Then shapeType = Val(InputBox(Prompt:=请输入图片版式:0=四周型,1=紧密型, & vbLf & _ 3=衬于文字下方,4=浮于文字上方, Default:=0) For Each oShape In Activ

11、eDocument.InlineShapes Set oShape = oShape.ConvertToShape With oShape Select Case shapeType Case 0, 1 .WrapFormat.Type = shapeType Case 3 .WrapFormat.Type = 3 .ZOrder 5 Case 4 .WrapFormat.Type = 3 .ZOrder 4 Case Else Exit Sub End Select .WrapFormat.AllowOverlap = False End With Next Else For Each oShape In ActiveDocument.Shapes oShape.ConvertToInlineShape Next End If End SubSub 图片方向() Dim n On Error Resume Next For n = 1 To ActiveDocument.Shapes.Count ActiveDocument.Shapes(n).IncrementRotation -90# Next nEnd Sub

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服