创建宏以将电子表格中所选图像的大小减小50%并在其周围绘制0.25pt线

时间:2012-02-16 12:55:02

标签: excel image excel-vba format edit vba

我正在编写一份报告,详细说明Excel中许多图表的顺序。我需要将图像的大小减小50%并在其周围绘制一条重量为0.25pt的线。

我试图录制一个宏但是这个空白。我已经读过图片格式化步骤没有被记录下来并被忽略。

我正在使用Excel 2007

1 个答案:

答案 0 :(得分:2)

Sub EditShapes()
'This Sub Edit all Shapes in all Sheets

Dim sht As Worksheet
Dim shp As Shape

For Each sht In ActiveWorkbook.Sheets
        For Each shp In sht.Shapes
            shp.Width = shp.Width / 2
            shp.Height = shp.Height / 2
            shp.Line.Weight = 0.25
        Next shp
Next sht

End Sub

选择形状

Sub EditSelectShape()
Dim shp As ShapeRange

Set shp = Selection.ShapeRange

shp.Width = shp.Width / 2
shp.Height = shp.Height / 2
shp.Line.Weight = 0.25

End Sub