Hi Mike,
The following version restricts operation to visible commandbars:
'=============
Public Sub TesterA001()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=4)
With Ctrl
If .Parent.Visible Then
MsgBox "Commandbar: " & .Parent.Name _
& " position = " & .Index
End If
End With
Next Ctrl
End Sub
'<<=============
---
Regards,
Norman
"Norman Jones" wrote in message
...
Hi Mike,
As a starting point, try:
'=============
Public Sub TesterA001()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=4)
MsgBox "Commandbar: " & Ctrl.Parent.Name _
& " position = " &
Ctrl.Index
Next Ctrl
End Sub
'<<=============
---
Regards,
Norman
"mikeburg" wrote
in message ...
What would be the simplest VBA code to locate the command bar number
that the printer command button is on & put the number into a
variable.
I am trying to add two command buttons immediately after the printer
command button but it's on different command bars from computer to
computer.
For example, it may be on command bar #3 on one computer but on #4 of
another computer.
Thanks. I dream of a day when I would be half as good at VBA as you
guys. Thanks, mikeburg
--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:
http://www.excelforum.com/member.php...o&userid=24581
View this thread:
http://www.excelforum.com/showthread...hreadid=507006