How can I get the name, size and position coordinates of all the objects
in an area (such as the screen) to be entered into a list.
For example let's say we drew 4 shapes. A square, a circle a triangle
and a rectangle. Then let's say I moved these objects around on the
screen, resized the triangle and cut the circle.
Now I need a macro that will identify the names of the shapes that are
left on the screen and give me the sizes of each shape and their
location.--
famdamly
------------------------------------------------------------------------
famdamly's Profile: www.excelforum.com/member.php...oamp;userid=29382
View this thread: www.excelforum.com/showthread...hreadid=516598One way:
Public Sub GetShapes()
Dim vShape As Variant
Dim i As Long
With ActiveSheet.Shapes
If .Count gt; 0 Then
ReDim vShape(1 To .Count, 1 To 5)
For i = 1 To .Count
vShape(i, 1) = .Item(i).Name
vShape(i, 2) = .Item(i).Top
vShape(i, 3) = .Item(i).Left
vShape(i, 4) = .Item(i).Height
vShape(i, 5) = .Item(i).Width
Next i
.Parent.Range(quot;A1quot;).Resize(1, 5) = _
Array(quot;Namequot;, quot;Topquot;, quot;Leftquot;, quot;Heightquot;, quot;Widthquot;)
.Parent.Range(quot;A2quot;).Resize(.Count, 5).Value = vShape
End If
End With
End Sub
In article gt;,
famdamly gt; wrote:
gt; How can I get the name, size and position coordinates of all the objects
gt; in an area (such as the screen) to be entered into a list.
gt; For example let's say we drew 4 shapes. A square, a circle a triangle
gt; and a rectangle. Then let's say I moved these objects around on the
gt; screen, resized the triangle and cut the circle.
gt;
gt; Now I need a macro that will identify the names of the shapes that are
gt; left on the screen and give me the sizes of each shape and their
gt; location.
Wow, that works superbly well. I'm amazed, I wish I could make this
stuff seem so easy. I've searched the vba help feature for quite some
time looking for ways to do any of that to no avail. Thanks a bunch for
all of the frustration you spared me.--
famdamly
------------------------------------------------------------------------
famdamly's Profile: www.excelforum.com/member.php...oamp;userid=29382
View this thread: www.excelforum.com/showthread...hreadid=516598
- Oct 22 Sun 2006 20:09
Identifying
close
全站熱搜
留言列表
發表留言