[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

How to list objects defined - buttons, etc.?

G Lykos

12/17/2006 8:40:00 AM

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

Thanks,
George


2 Answers

Helmut Weber

12/17/2006 8:57:00 AM

0

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

12/17/2006 1:24:00 PM

0

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" <nbhymsjxdgcn@mailinator.com> wrote in message
news:sg1ao212ernij07fci28rag5if1b36kmfh@4ax.com...
> 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"