Icon Macro

  • Thread starter Thread starter al007
  • Start date Start date
A

al007

Can I have a macro which would list my icon's control id & description
& tell me which macro from my personal.xls is assigned to it.
Thxs
 
Below is a macro that will find and list all custom buttons.

HTH,
Bernie
MS Excel MVP

Sub FindAllUserDefinedButtons()
Dim CmdBar As CommandBar
On Error GoTo ErrorReading:

For Each CmdBar In CommandBars
For i = 1 To CmdBar.Controls.Count
If CmdBar.Controls(i).BuiltIn = False Then
ActiveCell.Value = i
ActiveCell.Offset(0, 1).Value = CmdBar.Controls(i).Caption
ActiveCell.Offset(0, 2).Value = CmdBar.Name
ActiveCell.Offset(0, 3).Value = CmdBar.Controls(i).ID
ActiveCell.Offset(0, 4).Value = CmdBar.Controls(i).OnAction
ActiveCell.Offset(1, 0).Select
On Error GoTo ErrorReading:
If CmdBar.Controls(i).Type = msoControlPopup Then
For j = 1 To CmdBar.Controls(i).Controls.Count
ActiveCell.Value = "'" & i & " / " & j
ActiveCell.Offset(0, 1).Value = CmdBar.Controls(i).Controls(j).Caption
ActiveCell.Offset(0, 2).Value = CmdBar.Name
ActiveCell.Offset(0, 3).Value = CmdBar.Controls(i).ID
ActiveCell.Offset(0, 4).Value = CmdBar.Controls(i).Controls(j).OnAction
ActiveCell.Offset(1, 0).Select
Next j
End If

End If
ErrorReading:
Next i
Next CmdBar
End Sub
 
Excellent !! - Exactly what I wanted - many thxs
Bernie said:
Below is a macro that will find and list all custom buttons.

HTH,
Bernie
MS Excel MVP

Sub FindAllUserDefinedButtons()
Dim CmdBar As CommandBar
On Error GoTo ErrorReading:

For Each CmdBar In CommandBars
For i = 1 To CmdBar.Controls.Count
If CmdBar.Controls(i).BuiltIn = False Then
ActiveCell.Value = i
ActiveCell.Offset(0, 1).Value = CmdBar.Controls(i).Caption
ActiveCell.Offset(0, 2).Value = CmdBar.Name
ActiveCell.Offset(0, 3).Value = CmdBar.Controls(i).ID
ActiveCell.Offset(0, 4).Value = CmdBar.Controls(i).OnAction
ActiveCell.Offset(1, 0).Select
On Error GoTo ErrorReading:
If CmdBar.Controls(i).Type = msoControlPopup Then
For j = 1 To CmdBar.Controls(i).Controls.Count
ActiveCell.Value = "'" & i & " / " & j
ActiveCell.Offset(0, 1).Value = CmdBar.Controls(i).Controls(j).Caption
ActiveCell.Offset(0, 2).Value = CmdBar.Name
ActiveCell.Offset(0, 3).Value = CmdBar.Controls(i).ID
ActiveCell.Offset(0, 4).Value = CmdBar.Controls(i).Controls(j).OnAction
ActiveCell.Offset(1, 0).Select
Next j
End If

End If
ErrorReading:
Next i
Next CmdBar
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