Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default order of toolbars in Excel 2007

Well, I'm not sure if anyone has explored the Office 2007 enough to be able
to answer this question or not, but thought I'd give it a shot. I have an
Add-In that I've developed, compatible with Excel 2000 through Excel 2003 and
am looking for a way to control the order of 3 Custom Toolbars the Add-in
deploys in the Add-Ins Tab of Excel 2007's "Ribbon". After quite a bit of
finagling, the present code makes use of the following approach (not actually
what I'm using because I had to monkey around with it and repeat some of the
code because it didn't always work across all 3 Excel versions without the
repetitive code, but it should suffice to convey the method):

With Application.CommandBars("1st Toolbar")
..Enabled = True
..Visible = True
..Position = msoBarTop
..Left = 0
End With
With Application.CommandBars("2nd Toolbar")
..Enabled = True
..Visible = True
..RowIndex = 2
..Left = 0
End With
With Application.CommandBars("3rd Toolbar")
..Enabled = True
..Visible = True
..RowIndex = msoBarRowLast
..Left = 0
End With

This code is seemingly ignored in Excel 2007 and the Toolbars are deployed
in a fashion I can't make sense of - I initially thought they might be sorted
alphanumerically and tried renaming the toolbars to see if that was the
trick, but that didn't work either. It also appeared that the toolbars were
deployed in the reverse order of what had been evident in Excel 2003, so I
tried re-ordering the code to see if that would force it to correct itself,
but no joy there, either. If anyone has any ideas on how to make this work in
Excel 2007, I'd love to hear them.

Thanks,

Jeff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default order of toolbars in Excel 2007

Well, I did a little experiment and it looks that the toolbars appear in the
order they were created, as opposed to the order they were made visible.
What do you think?

Sub MakeCmdbars()
MakeBar "Bar1", 1
MakeBar "Bar2", 4
MakeBar "Bar3", 7
CommandBars("Bar3").Visible = True
CommandBars("Bar2").Visible = True
CommandBars("Bar1").Visible = True
End Sub

Sub MakeBar(Nm As String, Seed As Integer)
Dim Counter As Integer
On Error Resume Next
CommandBars(Nm).Delete
On Error GoTo 0
With CommandBars.Add(Nm, , , True)
For Counter = Seed To Seed + 2
With .Controls.Add(msoControlButton)
.Style = 2
.Caption = "Control " & Counter
End With
Next
End With
End Sub

--
Jim

"JeffreyW" wrote in message
...
Well, I'm not sure if anyone has explored the Office 2007 enough to be
able
to answer this question or not, but thought I'd give it a shot. I have an
Add-In that I've developed, compatible with Excel 2000 through Excel 2003
and
am looking for a way to control the order of 3 Custom Toolbars the Add-in
deploys in the Add-Ins Tab of Excel 2007's "Ribbon". After quite a bit of
finagling, the present code makes use of the following approach (not
actually
what I'm using because I had to monkey around with it and repeat some of
the
code because it didn't always work across all 3 Excel versions without the
repetitive code, but it should suffice to convey the method):

With Application.CommandBars("1st Toolbar")
.Enabled = True
.Visible = True
.Position = msoBarTop
.Left = 0
End With
With Application.CommandBars("2nd Toolbar")
.Enabled = True
.Visible = True
.RowIndex = 2
.Left = 0
End With
With Application.CommandBars("3rd Toolbar")
.Enabled = True
.Visible = True
.RowIndex = msoBarRowLast
.Left = 0
End With

This code is seemingly ignored in Excel 2007 and the Toolbars are deployed
in a fashion I can't make sense of - I initially thought they might be
sorted
alphanumerically and tried renaming the toolbars to see if that was the
trick, but that didn't work either. It also appeared that the toolbars
were
deployed in the reverse order of what had been evident in Excel 2003, so I
tried re-ordering the code to see if that would force it to correct
itself,
but no joy there, either. If anyone has any ideas on how to make this work
in
Excel 2007, I'd love to hear them.

Thanks,

Jeff


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default order of toolbars in Excel 2007

Thanks for logging in on this, Jim. Interesting theory but in my case, I
don't know that it applies because my toolbars were not made with code but
manually through the toolbar Customization interface. I haven't been able to
find a way to change the way Excel 2007 orders such toolbars.

Jeff



"Jim Rech" wrote:

Well, I did a little experiment and it looks that the toolbars appear in the
order they were created, as opposed to the order they were made visible.
What do you think?

Sub MakeCmdbars()
MakeBar "Bar1", 1
MakeBar "Bar2", 4
MakeBar "Bar3", 7
CommandBars("Bar3").Visible = True
CommandBars("Bar2").Visible = True
CommandBars("Bar1").Visible = True
End Sub

Sub MakeBar(Nm As String, Seed As Integer)
Dim Counter As Integer
On Error Resume Next
CommandBars(Nm).Delete
On Error GoTo 0
With CommandBars.Add(Nm, , , True)
For Counter = Seed To Seed + 2
With .Controls.Add(msoControlButton)
.Style = 2
.Caption = "Control " & Counter
End With
Next
End With
End Sub

--
Jim

"JeffreyW" wrote in message
...
Well, I'm not sure if anyone has explored the Office 2007 enough to be
able
to answer this question or not, but thought I'd give it a shot. I have an
Add-In that I've developed, compatible with Excel 2000 through Excel 2003
and
am looking for a way to control the order of 3 Custom Toolbars the Add-in
deploys in the Add-Ins Tab of Excel 2007's "Ribbon". After quite a bit of
finagling, the present code makes use of the following approach (not
actually
what I'm using because I had to monkey around with it and repeat some of
the
code because it didn't always work across all 3 Excel versions without the
repetitive code, but it should suffice to convey the method):

With Application.CommandBars("1st Toolbar")
.Enabled = True
.Visible = True
.Position = msoBarTop
.Left = 0
End With
With Application.CommandBars("2nd Toolbar")
.Enabled = True
.Visible = True
.RowIndex = 2
.Left = 0
End With
With Application.CommandBars("3rd Toolbar")
.Enabled = True
.Visible = True
.RowIndex = msoBarRowLast
.Left = 0
End With

This code is seemingly ignored in Excel 2007 and the Toolbars are deployed
in a fashion I can't make sense of - I initially thought they might be
sorted
alphanumerically and tried renaming the toolbars to see if that was the
trick, but that didn't work either. It also appeared that the toolbars
were
deployed in the reverse order of what had been evident in Excel 2003, so I
tried re-ordering the code to see if that would force it to correct
itself,
but no joy there, either. If anyone has any ideas on how to make this work
in
Excel 2007, I'd love to hear them.

Thanks,

Jeff



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
Transition from Excel 2003 to 2007 (toolbars, etc.) Austin Excel Discussion (Misc queries) 7 May 11th 08 09:34 PM
Toolbars placing at excel 2007 Vinod[_2_] Excel Discussion (Misc queries) 3 December 11th 07 07:29 PM
How do I control the order of Custom Toolbars appearing in the Add-Ins Tab of Excel 2007 Jeffrey W. Smith Excel Discussion (Misc queries) 1 October 26th 07 01:52 AM
Create personalized toolbars in Excel 2007 Ron de Bruin Excel Programming 2 January 19th 07 09:36 PM
Modify Custom Toolbars in Excel 2007 pawinterks Excel Discussion (Misc queries) 2 December 8th 06 10:34 PM


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