Looping through buttons on a worksheet.
Sub ddd()
Dim o As OLEObject
Dim t As msforms.ToggleButton
For Each o In ActiveSheet.OLEObjects
If TypeOf o.Object Is msforms.ToggleButton Then
Set t = o.Object
MsgBox t.Name & " value is " & t.Value & _
" at cell " & o.TopLeftCell.Address
End If
Next
End Sub
depressed is true, not depressed is false.
--
regards,
Tom Ogilvy
"Libby" wrote:
hello folks
I have a worksheet with a number of toggle buttons on it, which is menu for
opening other workbooks. When the user double clicks a toggle button it
opens a workbook.
However, the idea is that if the user wants to open more than one workbook,
then they can select the desired sheets via the togglebuttons and then click
a command button to open all where the togglebuttons are true.
How can I loop through the togglebuttons and if they are true call the
double click event? I need the code to be faily adaptable as there will be
new buttons added in the future.
I'm using XL2000
Many thanks in advance.
|