vba 在特殊粘贴后设置形状名称?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17356437/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 21:55:56 来源:igfitidea点击:
set shapes name after specialpaste?
提问by Hanxiao1017
How do I set the shapes name after specialpaste?
如何在特殊粘贴后设置形状名称?
Here's my codes.
这是我的代码。
With Sheets("sheet1")
.Shapes("testpic").Copy
.PasteSpecial Format:=xlBitmap
End With
How to set the new picture's name, as well as location(.top,.left,etc.)
如何设置新图片的名称,以及位置(.top、.left等)
回答by Doug Glancy
When you add a shape, it has the highest index, so:
添加形状时,它具有最高索引,因此:
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