Word宏设置图片大小

Word宏设置图片大小


1. Alt+F8, Create 一个Macro
2. 输入Macro名,进入编辑


---按比例缩小大量图片
Sub alex() '设置图片大小
 Dim n '图片个数
 On Error Resume Next '忽略错误
 For n = 1 To ActiveDocument.InlineShapes.Count 'InlineShapes类型图片
 picheight = ActiveDocument.InlineShapes(n).Height
 picwidth = ActiveDocument.InlineShapes(n).Width
 ActiveDocument.InlineShapes(n).Height = picheight * 0.5 '设置高度为0.5倍
 ActiveDocument.InlineShapes(n).Width = picwidth * 0.5 '设置宽度为0.5倍
 Next n
 For n = 1 To ActiveDocument.Shapes.Count 'Shapes类型图片
 picheight = ActiveDocument.Shapes(n).Height
 picwidth = ActiveDocument.Shapes(n).Width
 ActiveDocument.Shapes(n).Height = picheight * 0.5 '设置高度为0.5倍
 ActiveDocument.Shapes(n).Width = picwidth * 0.5 '设置宽度为0.5倍
 Next n
End Sub






---图片大小设置成绝对值  1cm=28px
Sub alex() '设置图片大小
 Dim n '图片个数
 On Error Resume Next '忽略错误
 For n = 1 To ActiveDocument.InlineShapes.Count 'InlineShapes类型图片
 picheight = ActiveDocument.InlineShapes(n).Height
 picwidth = ActiveDocument.InlineShapes(n).Width
 ActiveDocument.InlineShapes(n).Height = 280 '设置高度为280px
 ActiveDocument.InlineShapes(n).Width = 364 '设置宽度为364px
 Next n
 For n = 1 To ActiveDocument.Shapes.Count 'Shapes类型图片
 picheight = ActiveDocument.Shapes(n).Height
 picwidth = ActiveDocument.Shapes(n).Width
 ActiveDocument.Shapes(n).Height = 280 '设置高度为280px
 ActiveDocument.Shapes(n).Width = 364 '设置宽度为364px
 Next n
End Sub




3. 保持,再次进入原来的word,alt-f8 run这个宏


分享文章:Word宏设置图片大小
浏览路径:http://bzwzjz.com/article/jespod.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 定制级高端网站建设 成都企业网站制作 成都网站设计 企业网站设计 成都网站设计公司 企业网站设计 网站建设费用 成都网站建设 网站设计 梓潼网站设计 成都网站建设 成都营销网站建设 广安网站设计 温江网站设计 阿坝网站设计 成都网站建设 成都网站建设 手机网站制作设计 外贸营销网站建设 成都品牌网站设计 企业网站建设 专业网站建设