ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to list objects defined - buttons, etc.? (https://www.excelbanter.com/excel-programming/379564-how-list-objects-defined-buttons-etc.html)

G Lykos

How to list objects defined - buttons, etc.?
 
Greetings! Is there a way to create a list of the objects, such as buttons,
defined in a workbook?

Thanks,
George



Helmut Weber[_2_]

How to list objects defined - buttons, etc.?
 
Hi George,

maybe you are looking for something
along these lines:

Sub Test90023()
Dim oSht As Worksheet
Set oSht = ActiveSheet
Dim lCnt As Long
For lCnt = 1 To oSht.Shapes.Count
If oSht.Shapes(lCnt).Type = msoFormControl Then
MsgBox oSht.Shapes(lCnt).FormControlType
End If
Next
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Bob Phillips

How to list objects defined - buttons, etc.?
 
A bit more generic

Sub Test90023()
Dim oSht As Worksheet
Set oSht = ActiveSheet
Dim lCnt As Long
For lCnt = 1 To oSht.Shapes.Count
MsgBox oSht.Shapes(lCnt).Name & " at " &
oSht.Shapes(lCnt).TopLeftCell.Address
Next
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Helmut Weber" wrote in message
...
Hi George,

maybe you are looking for something
along these lines:

Sub Test90023()
Dim oSht As Worksheet
Set oSht = ActiveSheet
Dim lCnt As Long
For lCnt = 1 To oSht.Shapes.Count
If oSht.Shapes(lCnt).Type = msoFormControl Then
MsgBox oSht.Shapes(lCnt).FormControlType
End If
Next
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"





All times are GMT +1. The time now is 06:24 AM.

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