批量更改word中图片大小为固定尺寸

在【开发工具】中创建名为setpicsize的宏,进入编辑器后输入以下代码:

  Dim i
    Dim Height, Weight
    Height = 300
    Weight = 200
    
    On Error Resume Next '忽略错误
    For i = 1 To ActiveDocument.InlineShapes.Count 'InlineShapes类型图片
            ActiveDocument.InlineShapes(i).Height = Height '设置图片高度为 Height_px
            ActiveDocument.InlineShapes(i).Width = Weight '设置图片宽度 Weight_px
    Next i

    For i = 1 To ActiveDocument.Shapes.Count 'Shapes类型图片
            ActiveDocument.Shapes(i).Height = Height '设置图片高度为 Height_px
            ActiveDocument.Shapes(i).Width = Weight '设置图片宽度 Weight_px
    Next i
End Sub

其中 Height 和    Weight的值自行指定,保存并关闭后,在含有大量要修改尺寸的图片的word文件中,点击上方的【开发工具】----> 【宏】——>  【setpicsize】——>【运行】即可

参考word中批量修改图片大小的两个方法

猜你喜欢

转载自blog.csdn.net/qq_29831163/article/details/89741288