ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA code to locate the command bar number the printer button is on (https://www.excelbanter.com/excel-programming/352008-re-vba-code-locate-command-bar-number-printer-button.html)

Norman Jones

VBA code to locate the command bar number the printer button is on
 
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





All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com