Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Joe Joe is offline
external usenet poster
 
Posts: 476
Default Adding Controls in a toolbar?

How can I add controls to a toolbar, using VBA code?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Adding Controls in a toolbar?

This will add a new control to the worksheet menu bar:

Sub NewControl()

Dim cmd As CommandBarButton

Set cmd = Application.CommandBars("Worksheet Menu Bar"). _
Controls.Add

With cmd
.BeginGroup = True
.Caption = "My New &Button"
.Style = msoButtonCaption
.BeginGroup = True
.OnAction = "Insert Macro Name Here"
End With

OnExit:

Set cmd = Nothing

End Sub

--
Kevin Backmann


"joe" wrote:

How can I add controls to a toolbar, using VBA code?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Adding Controls in a toolbar?

I was a bit too fast with the mouse click.

The .Caption statement is the name of your command with the ampersand
indicating which letter is the hot-key. And the OnAction statement is the
name of the macro you want to execute when the user clicks the button.
--
Kevin Backmann


"joe" wrote:

How can I add controls to a toolbar, using VBA code?

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
Are all properties of controls on ctrl toolbox toolbar accessable? -JEFF-[_2_] Excel Programming 15 August 26th 05 07:10 PM
adding controls to userform at runtime Ouka[_12_] Excel Programming 3 August 18th 05 08:11 PM
Adding controls to userform ExcelMonkey[_190_] Excel Programming 3 February 25th 05 11:30 AM
Is it possible to disable two or more controls from the same toolbar, when those cont Andoni[_50_] Excel Programming 0 September 16th 04 02:28 PM
Help with adding controls Badtaste2k Excel Programming 0 August 29th 03 11:38 PM


All times are GMT +1. The time now is 03:54 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"