如何命名所有形状

时间:2016-07-26 14:41:29

标签: vba

我有一个有很多形状的演示文稿,并希望将它们命名为“MyPicture#”,其中#是一个数字。例如,形状65将命名为MyPicture65。 VBA可以这样做吗?那怎么样?

1 个答案:

答案 0 :(得分:0)

Sub test()

    Dim sld         As Slide
    Dim shp         As Shape
    Dim lctr        As Long

    For Each sld In ActiveWindow.Presentation.Slides
        For Each shp In sld.Shapes
            lctr = lctr + 1
            shp.Name = "MyPicture" & lctr
        Next
    Next


End Sub