D donwb Sep 30, 2008 #1 Excel 2003 How can I programatically identify the name of an active (Visible) custom toolbar. donwb
P Peter T Sep 30, 2008 #2 On the not quite sure assumption that the ID of all custom toolbars is 1 - Sub test3() Dim i As Long Dim s As String Dim cbr As CommandBar s = "Visible Custom Toolbars - " & vbCr For Each cbr In Application.CommandBars If cbr.ID = 1 And cbr.Visible Then i = i + 1 s = s & cbr.Name & vbCr End If Next s = s & "Count = " & i MsgBox s End Sub Regards, Peter T
On the not quite sure assumption that the ID of all custom toolbars is 1 - Sub test3() Dim i As Long Dim s As String Dim cbr As CommandBar s = "Visible Custom Toolbars - " & vbCr For Each cbr In Application.CommandBars If cbr.ID = 1 And cbr.Visible Then i = i + 1 s = s & cbr.Name & vbCr End If Next s = s & "Count = " & i MsgBox s End Sub Regards, Peter T
D donwb Sep 30, 2008 #3 Many thanks Peter - that works fine. Peter T said: On the not quite sure assumption that the ID of all custom toolbars is 1 - Sub test3() Dim i As Long Dim s As String Dim cbr As CommandBar s = "Visible Custom Toolbars - " & vbCr For Each cbr In Application.CommandBars If cbr.ID = 1 And cbr.Visible Then i = i + 1 s = s & cbr.Name & vbCr End If Next s = s & "Count = " & i MsgBox s End Sub Regards, Peter T Click to expand...
Many thanks Peter - that works fine. Peter T said: On the not quite sure assumption that the ID of all custom toolbars is 1 - Sub test3() Dim i As Long Dim s As String Dim cbr As CommandBar s = "Visible Custom Toolbars - " & vbCr For Each cbr In Application.CommandBars If cbr.ID = 1 And cbr.Visible Then i = i + 1 s = s & cbr.Name & vbCr End If Next s = s & "Count = " & i MsgBox s End Sub Regards, Peter T Click to expand...