利用VBA宏批量解決Word中圖片大小、居中設置


 針對office的word文檔,先添加宏文件,再運行就可以。

Sub 圖片格式統一()
Myheigth = 8   '設置高度
Mywidth = 10   '設置寬度
On Error Resume Next
For Each iShape In ActiveDocument.InlineShapes
iShape.LockAspectRatio = msoFlase   '取消鎖定縱橫比
iShape.Height = 28.345 * Myheigth
iShape.Width = 28.345 * Mywidth

With iShape
.Range.ParagraphFormat.Reset
.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter '居中
End With

Next

For Each Shape In ActiveDocument.Shapes
Shape.LockAspectRatio = msoFlase
Shape.Height = 28.345 * Myheigth
Shape.Width = 28.345 * Mywidth

With Shape
.Range.ParagraphFormat.Reset
.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter '居中
End With

Next

End Sub

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM