Custom toolbar's name

D

donwb

Excel 2003

How can I programatically identify the name of an active (Visible) custom
toolbar.

donwb
 
P

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

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
 

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

Similar Threads

VBA Custom Toolbar 2
Error due Changed Drive 1
Reinstall Custom toolbars 6
VBA custom toolbar 3
Move Control with Scroll 2
Window Trigger Event. 2
Calendar control 2
Problem with Workbook_Activate event 3

Top