View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Initial position of floating toolbar

Try something like the following. The command bar will be on the same row as
the Standard command bar. Commented code shows how to place it on the first
or last row of command bars.

Sub AAA()
Dim CmdBar As Office.CommandBar
Dim Ctrl As Office.CommandBarButton

On Error Resume Next
Application.CommandBars("Test").Delete
On Error GoTo 0
Set CmdBar = Application.CommandBars.Add(Name:="Test", Position:=msoBarTop)
'CmdBar.RowIndex = msoBarRowFirst ' or msoBarRowLast
CmdBar.RowIndex = Application.CommandBars("Standard").RowIndex
CmdBar.Visible = True
Set Ctrl = CmdBar.Controls.Add(Type:=msoControlButton)
Ctrl.Caption = "Click Me"
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
I got some code from VBAExpress.com to create a floating toolbar on file
opening and it works well.
My problem is that the sheet that is on the screen is a busy sheet and the
initial position of the toolbar can easily bury the toolbar in the sheet
clutter. I would like to specify the initial position of the toolbar,
then the user can move it as he wishes.
How can I specify the initial position of the tool bar? The toolbar is
Commandbars("My Toolbar").
Thanks for your time. Otto