LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Floating Command button

This is very basic but it should give you a start... this code needs to be in
a standard code module.

Private Const MyBarName As String = "My Command Bar"

Public Sub AddMyBar()
Dim cbrMyBar As CommandBar
Dim btn As CommandBarButton

Set cbrMyBar = Application.CommandBars.Add(MyBarName)
cbrMyBar.Visible = True
Set btn = cbrMyBar.Controls.Add(Type:=msoControlButton)
With btn
.Style = msoButtonCaption
.Caption = "Tada"
.OnAction = "DoStuff"
End With
End Sub

Public Sub DeleteMyBar()
On Error Resume Next
Application.CommandBars(MyBarName).Delete
End Sub

Public Sub DoStuff()
MsgBox "Stuff"
End Sub

--
HTH...

Jim Thomlinson


"kev_06" wrote:


It's come to my attention that I have no idea how to add command buttons
to a commandbar.


--
kev_06
------------------------------------------------------------------------
kev_06's Profile: http://www.excelforum.com/member.php...o&userid=35046
View this thread: http://www.excelforum.com/showthread...hreadid=551659




 
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
Floating command button Pat Excel Discussion (Misc queries) 4 April 7th 06 01:28 PM
Create floating button based on button click in menu ExcelMonkey Excel Programming 2 October 12th 05 06:43 PM
How can I create a Floating Command Button Karoo News Excel Programming 1 August 19th 05 11:19 AM
My Command Buttons keep floating on the sheet??? alondon Excel Programming 2 November 28th 04 12:35 AM
Floating Command Button - How to??? TinyTim Excel Programming 6 January 2nd 04 07:23 AM


All times are GMT +1. The time now is 06:53 AM.

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"