Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
SF,
Try the code below. Copy it, paste it into a codemodule, and run the macro: AddFloatingCommandbarWith3Buttons HTH, Bernie MS Excel MVP Option Explicit Dim myBar As CommandBar Dim myButton As CommandBarButton Const myName As String = "MyFloatingCBar" Sub AddFloatingCommandbarWith3Buttons() On Error Resume Next Application.CommandBars(myName).Delete Set myBar = Application.CommandBars.Add(myName) With myBar .Position = msoBarFloating .Left = 100 .Top = 200 .Visible = True .Enabled = True Set myButton = .Controls.Add(Type:=msoControlButton, ID:=23) With myButton .Caption = "Hello" .Style = msoButtonIcon .FaceId = 137 .Enabled = True .OnAction = "SayHello" End With Set myButton = .Controls.Add(Type:=msoControlButton, ID:=23) With myButton .Caption = "Goodbye" .Style = msoButtonIcon .FaceId = 138 .Enabled = True .OnAction = "SayGoodbye" End With Set myButton = .Controls.Add(Type:=msoControlButton, ID:=23) With myButton .Caption = "Kill Me" .Style = msoButtonIcon .FaceId = 132 .Enabled = True .OnAction = "KillMe" End With End With End Sub Sub SayHello() MsgBox "Hello" End Sub Sub SayGoodbye() MsgBox "Goodbye" End Sub Sub KillMe() On Error Resume Next Application.CommandBars(myName).Delete End Sub "StargateFan" wrote in message ... Can anyone point me to an example file that actually creates a floating toolbar with, hopefully, at least 2 working buttons on it? I've googled the archives of this ng and all the examples I've tried bring up an extra box along the top menu, mimicking the upper left-hand corner of any sheet along the top (the one that just restores, minimizes and closes). Where I first saw this floating toolbar concept is in an invoice sheet that is completely locked down so I can't see the working code and how it does what it does. Pls, any help would be appreciated. I googled for this and only one example came up (in German <g), which I dl scanned for viruses and tried out but it wasn't the right thing, either. Thanks so much! :oD |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Floating toolbar and floating comment? | Excel Programming | |||
Floating Toolbar | Excel Discussion (Misc queries) | |||
PDF 4.0 Floating Toolbar | Excel Discussion (Misc queries) | |||
floating toolbar | Excel Programming | |||
Floating Toolbar | Excel Programming |