Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Command Bar position

Howdy
I want my command bar to be positioned what I can only think to call
"opposite to being floating".

Set MYCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarFloating, Temporary:=True)

what is the oppositite to the above? Is it msoBarTop - where does that put
it relative to the other menus bars that are at the top? I want to add it
above the main window but below all other toolbars.
And what and when is the following code used for:
MenuBar:=True
?

Thanks
Matt


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Command Bar position


Apart from msoBarFloating you can have
msoBarLeft
msoBarRight
msoBarTop
msoBarBottom

mosBarTop will put the command bar at the top just below the menubar.
(The topmost tool bar will be your commandbar).

If you set MenuBar:=True then the existing menubar (where you have File,
Edit, Instert etc. menus) will disappear and your command bar will take
its place if it is msoBarTop.

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Command Bar position

Thanks Sharad
So how do I put my command bar above my worksheet window below the menubar
but below the other command bars there and without replacing any of the
command bars that are there?
Do I just omit the Position property?
Thanks
Matt

"Sharad" wrote in message
...

Apart from msoBarFloating you can have
msoBarLeft
msoBarRight
msoBarTop
msoBarBottom

mosBarTop will put the command bar at the top just below the menubar.
(The topmost tool bar will be your commandbar).

If you set MenuBar:=True then the existing menubar (where you have File,
Edit, Instert etc. menus) will disappear and your command bar will take
its place if it is msoBarTop.

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Command Bar position

Matt,

You need to provide the "RowIndex"...

MyCommandBar.RowIndex = Application.CommandBars("Formatting").RowIndex + 1

If the Formatting toolbar is visible, the above code places MyCommandBar
just below the formatting toolbar.
No, you cannot determine the rowindex by just counting the visible toolbars.
Also, you still need msoBarTop.

OR, go thru the CommandBar collection and find the largest rowindex...

Sub TestBar()
Dim MyCommandBar As CommandBar
Dim lngBarIndex As Long

For Each MyCommandBar In Application.CommandBars
If MyCommandBar.Visible Then lngBarIndex = _
WorksheetFunction.Max(lngBarIndex, MyCommandBar.RowIndex)
Next

Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)
MyCommandBar.RowIndex = lngBarIndex + 1
MyCommandBar.Visible = True
Set MyCommandBar = Nothing
End Sub


Regards,
Jim Cone
San Francisco, USA


"Matt Jensen" wrote in message ...
Thanks Sharad
So how do I put my command bar above my worksheet window below the menubar
but below the other command bars there and without replacing any of the
command bars that are there?
Do I just omit the Position property?
Thanks
Matt



"Sharad" wrote in message
...

Apart from msoBarFloating you can have
msoBarLeft
msoBarRight
msoBarTop
msoBarBottom
mosBarTop will put the command bar at the top just below the menubar.
(The topmost tool bar will be your commandbar).
If you set MenuBar:=True then the existing menubar (where you have File,
Edit, Instert etc. menus) will disappear and your command bar will take
its place if it is msoBarTop.
Sharad


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Command Bar position

Matt,

Looks like there is an easier way, using msoBarRowLast...
'--------------------------
Sub TestBarModified()
Dim MyCommandBar As CommandBar

Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)

MyCommandBar.RowIndex = msoBarRowLast

MyCommandBar.Visible = True
Set MyCommandBar = Nothing
End Sub
'--------------------------

Regards,
Jim Cone


"Jim Cone" wrote in message
...
Matt,
You need to provide the "RowIndex"...
MyCommandBar.RowIndex = Application.CommandBars("Formatting").RowIndex + 1
If the Formatting toolbar is visible, the above code places MyCommandBar
just below the formatting toolbar.
No, you cannot determine the rowindex by just counting the visible toolbars.
Also, you still need msoBarTop.
OR, go thru the CommandBar collection and find the largest rowindex...
Sub TestBar()
Dim MyCommandBar As CommandBar
Dim lngBarIndex As Long
For Each MyCommandBar In Application.CommandBars
If MyCommandBar.Visible Then lngBarIndex = _
WorksheetFunction.Max(lngBarIndex, MyCommandBar.RowIndex)
Next
Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)
MyCommandBar.RowIndex = lngBarIndex + 1
MyCommandBar.Visible = True
Set MyCommandBar = Nothing
End Sub
Regards,
Jim Cone
San Francisco, USA




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Command Bar position

What do you mean by "Looks Like" Jim?

That's not only the easiest, but the 'Accurately Correct' way! :)

Thanks for me too (Apart from Matt will be thankful)
cheers!

Sharad





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Command Bar position

Great - thanks a lot guys - looks good
Cheers
Matt

"Jim Cone" wrote in message
...
Matt,

Looks like there is an easier way, using msoBarRowLast...
'--------------------------
Sub TestBarModified()
Dim MyCommandBar As CommandBar

Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)

MyCommandBar.RowIndex = msoBarRowLast

MyCommandBar.Visible = True
Set MyCommandBar = Nothing
End Sub
'--------------------------

Regards,
Jim Cone


"Jim Cone" wrote in message
...
Matt,
You need to provide the "RowIndex"...
MyCommandBar.RowIndex = Application.CommandBars("Formatting").RowIndex +

1
If the Formatting toolbar is visible, the above code places MyCommandBar
just below the formatting toolbar.
No, you cannot determine the rowindex by just counting the visible

toolbars.
Also, you still need msoBarTop.
OR, go thru the CommandBar collection and find the largest rowindex...
Sub TestBar()
Dim MyCommandBar As CommandBar
Dim lngBarIndex As Long
For Each MyCommandBar In Application.CommandBars
If MyCommandBar.Visible Then lngBarIndex = _
WorksheetFunction.Max(lngBarIndex, MyCommandBar.RowIndex)
Next
Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)
MyCommandBar.RowIndex = lngBarIndex + 1
MyCommandBar.Visible = True
Set MyCommandBar = Nothing
End Sub
Regards,
Jim Cone
San Francisco, USA




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
One command in one cell initiating another command in another cel. Chas52 Excel Worksheet Functions 3 November 7th 09 06:57 PM
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
command button position Gerry Excel Discussion (Misc queries) 4 November 2nd 08 12:39 PM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Command Button Position Kenny Excel Discussion (Misc queries) 3 October 14th 07 09:19 PM


All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"