word 插入图片222

我写论文时经常要把所有的图调整成一样大小,使用的都是以下的代码,供参考。至于批量插入图片等功能,因为写论文时从来用不上,也不知道应该弄成什么样子,所以无法回答你。

Sub 一次性调整公式以外的图片大小及格式()
       '功能 1 :把全文的图片调整成同样大小,公式除外
       '功能 2 :如果图片不是 jpg 格式的,统一调整成 jpg 格式并居中,以减小文档体积
       '========================
       Mywidth = 7 '需要的图片宽度(厘米)
       Myheigth = 5 '需要的图片高度(厘米)
       '========================
       Dim myPic As InlineShape
   For Each myPic In ActiveDocument.InlineShapes
       With myPic
               .Select
               Select Case .Type
               Case wdInlineShapePicture
                       .Height = 28.345 * Myheigth
                       .Width = 28.345 * Mywidth
                       Selection.ParagraphFormat.Alignment =
wdAlignParagraphCenter
                                         Selection.Cut
                       Selection.PasteSpecial Link:=False,
DataType:=15, Placement:=wdInLine, DisplayAsIcon:=False
               End Select
       End With
   Next
End Sub
原文地址:https://www.cnblogs.com/Ellen/p/2073878.html