Custom Toolbar position

M

Michelle

I have the follwoing code that creates a toolbar when the
workbook is open. What I want to do is to make it show up
at the top of the screen not right in the middle where it
does now. Help

Application.CommandBars.Add(Name:="COUNT").Visible =
True
Application.CommandBars("COUNT").Controls.Add
Type:=msoControlButton, ID:=3 _
, Before:=1
Application.CommandBars("COUNT").Controls.Add
Type:=msoControlButton, ID:= _
752, Before:=2
 
T

Tom Ogilvy

Application.CommandBars.Add(Name:="COUNT").Top = 0
would put it at the top of the screen
 
G

Guest

That puts it at the top, but I would like it to be
positioned at the topleft where the starndard toolbar
would have been had I not hidden it.
You would see the name of the file then the toolbar set in
postiton like a normal tool bar. If I have you lost I am
sorry
 
T

Tom Ogilvy

thought it was a floating toolbar:

Sub BBBB()
On Error Resume Next
Application.CommandBars("COUNT").Delete
On Error GoTo 0
Application.CommandBars.Add(Name:="COUNT", _
Position:=msoBarTop, MenuBar:=True).Visible = True
Application.CommandBars("COUNT").Controls.Add _
Type:=msoControlButton, ID:=3, Before:=1
Application.CommandBars("COUNT").Controls.Add _
Type:=msoControlButton, ID:=752, Before:=2
End Sub

delete COUNT to get the worksheet menu bar back.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top