zoukankan      html  css  js  c++  java
  • 利用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
  • 相关阅读:
    request、bs4爬虫
    1031 查验身份证
    1029 旧键盘
    1028 人口普查
    1027 打印沙漏
    1026 程序运行时间
    1025 反转链表
    1024 科学计数法
    1022 D进制的A+B
    1021 个位数统计
  • 原文地址:https://www.cnblogs.com/dydxw/p/14340377.html
Copyright © 2011-2022 走看看