Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Creating a custom toolbar add-in in Excel 2007

I have been able to create a custom toolbar add-in using vba in Excel 2007
from different examples that I have found on this site. The problem I am
running into is the visual layout of the toolbar. My drop down menu buttons
stack vertically instead of horizontally. Is there any way to change this? I
have a custom add-in that I found on the web that I had used in Excel 2003
and when I install it in 2007, the buttons are displayed horizontally. I
can't figure out where in the programming this is done.

I have attached some of my code that adds the drop down menus below. Am I
doing something wrong? Any help would be great! Thanks, Jason


Dim cmdBar As CommandBar
Dim cmdBarMenu As CommandBarControl
Dim cmdBarMenuItem As CommandBarControl


'drop down - Comments
Set cmdBar = Application.CommandBars("Worksheet Menu Bar")
Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup,
befo=cmdBar.Controls("Window").Index)
cmdBarMenu.Caption = "Comments"
cmdBarMenu.Tag = "JJT"

Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "Create rounded comment"
.OnAction = "RoundedComment"
.Tag = "JJT"
.FaceId = 588
End With

Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "Change comment color"
.OnAction = "ChangeCommentColor"
.Tag = "JJT"
.FaceId = 1691
End With



'drop down - Formatting
Set cmdBar = Application.CommandBars("Worksheet Menu Bar")
Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup,
befo=cmdBar.Controls("Window").Index)
cmdBarMenu.Caption = "Formatting"
cmdBarMenu.Tag = "JJT"
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "###°"
.OnAction = "DegreesFormat"
.Tag = "JJT"
End With
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "## ###/###"
.OnAction = "HPFormat"
.Tag = "JJT"
End With
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "## ##/##"
.OnAction = "InchesFractionalFormat"
.Tag = "JJT"
End With
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "#,###"
.OnAction = "NumberCommaFormat"
.Tag = "JJT"
End With
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "# ##/##Ø"
.OnAction = "DiameterInchesFractionsFormat"
.Tag = "JJT"
End With
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "##Ø"
.OnAction = "DiameterInchesFormat"
.Tag = "JJT"
End With
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "##.#"
.OnAction = "GPMFormat"
.Tag = "JJT"
End With





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Creating a custom toolbar add-in in Excel 2007

We don't have any direct control over how Excel puts our commandbar
customizations on the Add-in tab of the ribbon. It seems to add them to the
Menu Commands group of the Add-ins tab in the order they are loaded/created.
It stacks the first three and then starts a new stack of up to three, etc.

I suppose if you added two bogus/empty items to your code, between the two
you have, that would force your second, now fourth, item up next to the
first. That assumes nothing else it being added before your customizations
so that your first is first in a stack.

--
Jim
"test_52" wrote in message
...
|I have been able to create a custom toolbar add-in using vba in Excel 2007
| from different examples that I have found on this site. The problem I am
| running into is the visual layout of the toolbar. My drop down menu
buttons
| stack vertically instead of horizontally. Is there any way to change this?
I
| have a custom add-in that I found on the web that I had used in Excel 2003
| and when I install it in 2007, the buttons are displayed horizontally. I
| can't figure out where in the programming this is done.
|
| I have attached some of my code that adds the drop down menus below. Am I
| doing something wrong? Any help would be great! Thanks, Jason
|
|
| Dim cmdBar As CommandBar
| Dim cmdBarMenu As CommandBarControl
| Dim cmdBarMenuItem As CommandBarControl
|
|
| 'drop down - Comments
| Set cmdBar = Application.CommandBars("Worksheet Menu Bar")
| Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup,
| befo=cmdBar.Controls("Window").Index)
| cmdBarMenu.Caption = "Comments"
| cmdBarMenu.Tag = "JJT"
|
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "Create rounded comment"
| .OnAction = "RoundedComment"
| .Tag = "JJT"
| .FaceId = 588
| End With
|
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "Change comment color"
| .OnAction = "ChangeCommentColor"
| .Tag = "JJT"
| .FaceId = 1691
| End With
|
|
|
| 'drop down - Formatting
| Set cmdBar = Application.CommandBars("Worksheet Menu Bar")
| Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup,
| befo=cmdBar.Controls("Window").Index)
| cmdBarMenu.Caption = "Formatting"
| cmdBarMenu.Tag = "JJT"
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "###"
| .OnAction = "DegreesFormat"
| .Tag = "JJT"
| End With
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "## ###/###"
| .OnAction = "HPFormat"
| .Tag = "JJT"
| End With
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "## ##/##""
| .OnAction = "InchesFractionalFormat"
| .Tag = "JJT"
| End With
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "#,###"
| .OnAction = "NumberCommaFormat"
| .Tag = "JJT"
| End With
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "# ##/##""
| .OnAction = "DiameterInchesFractionsFormat"
| .Tag = "JJT"
| End With
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "##""
| .OnAction = "DiameterInchesFormat"
| .Tag = "JJT"
| End With
| Set cmdBarMenuItem = cmdBarMenu.Controls.Add
| With cmdBarMenuItem
| .Caption = "##.#"
| .OnAction = "GPMFormat"
| .Tag = "JJT"
| End With
|
|
|
|
|


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
Can I have more than 1 custom toolbar add-in in Excel 2007? Tracey Excel Discussion (Misc queries) 1 February 18th 10 05:48 AM
Delete a custom toolbar in excel 2007 from Add-Ins mmmaaatttsss Setting up and Configuration of Excel 2 October 4th 09 11:13 PM
How do I set up a custom toolbar in Excel 2007? est_da Excel Discussion (Misc queries) 5 May 11th 08 09:47 PM
Excel 2007 Error 400 from custom toolbar Phil A.[_2_] Excel Programming 2 October 7th 07 10:10 PM
Backup custom toolbar in excel 2007, how? dk_ Excel Discussion (Misc queries) 6 September 4th 07 02:33 AM


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