Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
command button code dummy Excel Discussion (Misc queries) 2 December 1st 09 02:57 PM
VBA code behind command button [email protected] Excel Worksheet Functions 1 March 22nd 06 08:13 PM
Using code from custom menu bar to a Command button Alex Martinez Excel Programming 0 September 27th 05 06:33 AM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM
Create Command Button from Code Bruce B[_2_] Excel Programming 0 July 14th 03 02:01 PM


All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"