软体印象

Kavin
posts - 13, comments - 0, trackbacks - 0, articles - 0

Word中如何批量统一设置图片的大小

Posted on 2010-03-25 16:17 Kavin 阅读(6664) 评论(0)  编辑  收藏
 

1. 使用宏操作 录制宏并添加快捷键(ctl+shift+h);选中要修改的图片,使用快捷键。

Sub ResizeShape()

'

' ResizeShape Macro

' Macro recorded 2010-3-25 by Kavin

'

    Selection.InlineShapes(1).Fill.Visible = msoFalse

    Selection.InlineShapes(1).Fill.Solid

    Selection.InlineShapes(1).Fill.Transparency = 0#

    Selection.InlineShapes(1).Line.Weight = 0.75

    Selection.InlineShapes(1).Line.Transparency = 0#

    Selection.InlineShapes(1).Line.Visible = msoFalse

    Selection.InlineShapes(1).LockAspectRatio = msoTrue

    Selection.InlineShapes(1).Height = 198.15

    Selection.InlineShapes(1).Width = 264.45

    Selection.InlineShapes(1).PictureFormat.Brightness = 0.5

    Selection.InlineShapes(1).PictureFormat.Contrast = 0.5

    Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic

    Selection.InlineShapes(1).PictureFormat.CropLeft = 0#

    Selection.InlineShapes(1).PictureFormat.CropRight = 0#

    Selection.InlineShapes(1).PictureFormat.CropTop = 0#

    Selection.InlineShapes(1).PictureFormat.CropBottom = 0#

End Sub

2. 使用宏程序操作 创建宏程序,然后执行

Sub batchResizeShape()

    Dim doc     As Document

  Dim i     As Integer

  Set doc = ActiveDocument 

  For i = 1 To doc.InlineShapes.Count

  'doc.InlineShapes 

      'doc.Shapes(i).ScaleHeight 0.5, msoFalse, msoScaleFromMiddle

      'doc.Shapes(i).ScaleWidth 0.5, msoFalse, msoScaleFromMiddle

      doc.InlineShapes(i).Height = 198.15

    doc.InlineShapes(i).Width = 264.45

  Next i

 

End Sub


只有注册用户登录后才能发表评论。


网站导航: