Get Button Names (worksheet)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I get the names of buttons on a work sheet, I have many workbooks
with many worksheets and 4 buttons per sheet that the names are unknown, IE,
Button1, Button 2, Button3, Button101, etc.
I am trying to get the names so I can progmatically assign macros.
I knwo how to get the info when I click on them, but I don't have the time
nor the patience to click on every darn one. ;)

--
Regards

Rick
XP Pro
Office 2007
 
try
Sub getshapenames()
For Each Sh In ActiveSheet.Shapes
MsgBox Sh.Name
Next
End Sub
 
I miss worded my query, I need to know the name of the Caption for the Button.
--
Regards

Rick
XP Pro
Office 2007
 
One way:

Dim btn As Button
For Each btn In ActiveSheet.Buttons
MsgBox btn.Caption
Next btn
 
This will change the text from a list of the shape names with the text in
the cell to the right

Sub NameShapes()
Sheets("checks").Select
For Each c In [setup!a4:a15]
ActiveSheet.Shapes(c).TextFrame. _
Characters.Text = c.Offset(0, 1)
Next c
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top