读书人

怎么设置Word文档中大量图片宽度高度

发布时间: 2012-09-12 09:21:30 作者: rapoo

如何设置Word文档中大量图片宽度高度
如何设置Word文档中大量图片宽度高度

要求:
1.把所有图片宽度都设为同一个值,高度按比例改变大小
2.不能一个一个地操作,太多了,以后还会大量增加,用菜单行,用代码也行


[解决办法]

VB code
Sub 批量设置图片大小()    Dim odoc As Document    Dim oInShp As InlineShape    Set odoc = ActiveDocument    For Each oInShp In odoc.InlineShapes        With oInShp            If .Type = wdInlineShapePicture Then                .LockAspectRatio = msoFalse                .Width = MillimetersToPoints(50)                .Height = MillimetersToPoints(50)            End If        End With    Next oInShpEnd Sub
[解决办法]
这样可以啊,只保留一个宽度设置,并锁定纵横比。
VB code
Sub 批量设置图片大小()    Dim odoc As Document    Dim oInShp As InlineShape    Set odoc = ActiveDocument    For Each oInShp In odoc.InlineShapes        With oInShp            If .Type = wdInlineShapePicture Then                .LockAspectRatio = msoTrue                .Width = MillimetersToPoints(50)            End If        End With    Next oInShpEnd Sub 

读书人网 >OFFICE教程

热点推荐