Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the names of objects

Status
Not open for further replies.

Yogi39

Technical User
Joined
Jun 20, 2001
Messages
273
Location
CA
I've insert a rectangle in a workbook and assigned a macro to it, actualy I have a few rectangles to which macros are attached.
I need to refer to the rectangles from VB,
How do I get the name of a particular rectangle ?
???ActiveSheet.Shapes("Rectangle ?").Select
 
Also, is it possible to write and or read the text of that triangle ?
That is :
the macro attached to a rectangle hides rows greater that X
so when the user clicks on the rectangle the macro hides all rows less than X.
The catch.....
I want the text of that rectangle to change to ">x" and when re clicked have the text change to "all"

Is this doable ?
 
Hi,
In the Name Box is a unique name for each object in your sheet. Here is a small procedure that will display the Name of each one.
Code:
Sub Objects()
    Dim Shape As Object
    With Sheets(1)
        For Each Shape In .Shapes
            With Shape.DrawingObject
                MsgBox .Name & " " & .Text
            End With
        Next
    End With
End Sub
[\code]
Shape.DrawingObject.Text can be changed.  Shape.DrawingObject.OnAction can be changed.

Hope this helps  :-)
 Skip,
SkipAndMary1017@mindspring.com
 
So if my shape name is Rectangle 5

how would I insert the text " View >60" to Rectangle 5
how would I read the text to know wich macro to call
that is if user clicks the box when the text is " View >60"
the hide macro is called and the text would get replaced by ">60" and if the user now clicks on the same rectangle the unhide macro is called and the text gets replaced by " View >60"
 
Thanks fo rthe help Skip !

this seems to do it...:)
Sub cool()


D = ActiveSheet.Shapes("Rectangle 10").TextFrame.Characters.Text
If D = "Test Label" Then ActiveSheet.Shapes("Rectangle 10").TextFrame.Characters.Text = "Swtich" _
Else ActiveSheet.Shapes("Rectangle 10").TextFrame.Characters.Text = "Test Label"
End Sub
 
How can I mod this to read and name checkboxes ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top