如何将图片从一个评论复制到另一个评论?

时间:2017-02-05 22:44:40

标签: excel vba excel-vba

所以我对一个包含设置图片的单元格进行了评论 ActiveCell.Comment.Shape.UserPiсture“C:\ path \ img.png”

但我希望将它复制到另一个单元格。我该怎么做?

1 个答案:

答案 0 :(得分:2)

您需要使用Shape PickupApply方法,但您将获得评论形状的所有设置格式,而不仅仅是图片。< / p>

Sub test()

  Dim comment1 As Shape
  Dim comment2 As Shape

  Set comment1 = Sheet1.Shapes("Comment 1")
  Set comment2 = Sheet1.Shapes("Comment 2")

  'Copy all of the formats from the comment's shape
  comment1.PickUp

  'Paste all of the copied formats to the target
  comment2.Apply

End Sub