ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get Button Names (worksheet) (https://www.excelbanter.com/excel-programming/399512-get-button-names-worksheet.html)

Rick S.

Get Button Names (worksheet)
 
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


Don Guillett

Get Button Names (worksheet)
 
try
Sub getshapenames()
For Each Sh In ActiveSheet.Shapes
MsgBox Sh.Name
Next
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rick S." wrote in message
...
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



Rick S.

Get Button Names (worksheet)
 
I miss worded my query, I need to know the name of the Caption for the Button.
--
Regards

Rick
XP Pro
Office 2007



"Rick S." wrote:

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


JE McGimpsey

Get Button Names (worksheet)
 
One way:

Dim btn As Button
For Each btn In ActiveSheet.Buttons
MsgBox btn.Caption
Next btn

In article ,
Rick S. wrote:

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. ;)


Don Guillett

Get Button Names (worksheet)
 
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rick S." wrote in message
...
I miss worded my query, I need to know the name of the Caption for the
Button.
--
Regards

Rick
XP Pro
Office 2007



"Rick S." wrote:

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




All times are GMT +1. The time now is 12:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com