Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with command bar positioning

I have been successful in creating a custom commandbar with the button
I need. I would like to place the custom commandbar on the end of th
built in commandbars at the top of my window. I can get it up there
but it seems to want to live on a line all by itself. I've been usin
the following command:

commandbars("custom").rowindex = 2

It puts my bar where I want it, but moves the builtins down a row. An
advice out there?

Thanks,
Roge

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default help with command bar positioning

Roger,

You need to se the .Left and .RowIndex of your new commandbar based on an
existing commandbar. See the code example below.

HTH,
Bernie
MS Excel MVP

Sub AddSecondCommandbarAfterFirst()
Dim myBar1 As CommandBar
Dim myBar2 As CommandBar

On Error Resume Next
Application.CommandBars("NewCBName").Delete

Set myBar1 = Application.CommandBars("OldCBName")
Set myBar2 = Application.CommandBars.Add("NewCBName")

With myBar2
Set myButton = myBar.Controls.Add(Type:=msoControlButton, ID:=23)
With myButton
.Caption = "This or that"
.Style = msoButtonIcon
.FaceId = 137
End With
.Position = msoBarTop
.Left = myBar1.Width
.RowIndex = myBar1.RowIndex
.Visible = True
.Enabled = True
End With

End Sub


"rogervand " wrote in message
...
I have been successful in creating a custom commandbar with the buttons
I need. I would like to place the custom commandbar on the end of the
built in commandbars at the top of my window. I can get it up there,
but it seems to want to live on a line all by itself. I've been using
the following command:

commandbars("custom").rowindex = 2

It puts my bar where I want it, but moves the builtins down a row. Any
advice out there?

Thanks,
Roger


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with command bar positioning

Thanks for the help Bernie. I stumbled across the solution a few minute
after posting. I was able to set the position relative to th
"Standard" command bar

--
Message posted from http://www.ExcelForum.com

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
Forms Positioning DUknow Excel Discussion (Misc queries) 0 May 6th 09 01:29 AM
Positioning all pictures gejmond Excel Discussion (Misc queries) 3 June 26th 06 08:48 PM
= positioning snax500[_2_] Excel Programming 1 June 28th 04 08:24 PM
Userforms Positioning TanahAirShah Excel Programming 0 January 14th 04 12:11 AM
msgbox positioning Wild Bill[_2_] Excel Programming 4 August 28th 03 06:08 PM


All times are GMT +1. The time now is 03:56 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"