1

如何在特殊粘贴后设置形状名称?

这是我的代码。

With Sheets("sheet1")
  .Shapes("testpic").Copy
  .PasteSpecial Format:=xlBitmap
End With

如何设置新图片的名称,以及位置(.top,.left等)

4

1 回答 1

3

添加形状时,它的索引最高,因此:

Sub CopyShape()
Dim ws As Excel.Worksheet

Set ws = Sheets("sheet1")
With ws
    .Shapes("testpic").Copy
    .PasteSpecial Format:=xlBitmap
    With .Shapes(.Shapes.Count)
        .Name = "myName"
        .Top = 100
        'etc.
    End With
End With
End Sub
于 2013-06-28T03:46:20.513 回答