vba 如何获取工作表中形状的相对位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22773816/
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
how to get the relative position of shapes within a worksheet
提问by yoshiserry
If you think of cells, we know logically that Row 2 is higher than row 100.
如果您考虑单元格,我们从逻辑上知道第 2 行高于第 100 行。
However If I had two shapes (lets say circles) how do I determine which one is higher than the other, or further left than the rest?
但是,如果我有两个形状(比如圆形),我如何确定哪个比另一个高,或者比其他的更左?
UPDTAE
UPDTAE
- Where is the Object model for all Objects and methods / attributes for things like 1. charts >> The Top left
- 1. 图表 >> 左上角的所有对象和方法/属性的对象模型在哪里
回答by Gary's Student
Here is some code to display the row for each Shape:
下面是一些代码来显示每个形状的行:
Sub dural()
Dim s As Shape, mesage As String
For Each s In ActiveSheet.Shapes
mesage = mesage & vbCrLf & s.Name & "---" & s.TopLeftCell.Row
Next s
MsgBox mesage
End Sub