W
Walt Weber
Hi,
Is there something different in Excel 2003 with regard to
creating a commandbar? The code below works fine with
Excel 2000 and 2002, but fails where indicated below with
Excel 2003 (It's been reported on 2 machines so far).
Best Regards,
Walt
NOTES:
1) I may have to advance the timing when I buy Excel 2003.
2) I don't specify the MenuBar argument since its default
is False and that's what I want.
3) Please forgive the text wrap.
**********************
Sub ResetBars()
For Each bar In Application.CommandBars
If Not bar.BuiltIn And bar.Name <> "MyBar" Then
bar.Delete
Next
End Sub
'******** A LA CARTE ENTRY SCREEN TOOL BAR ************
Sub FloatingAlaCarteToolBar()
If NoToolBar = True Then Exit Sub
Call ResetBars
'WORKS IN EXCEL 2000 & 2002, BUT FAILS HERE IN EXCEL 2003
Set TB_AlaCarte = CommandBars.Add(Name:=" ",
Position:=msoBarFloating, Temporary:=True) '<<<<<<<<
Set button1 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button1
.FaceId = 1016
.Style = msoButtonIconAndCaption
.Tag = "Home"
.Caption = "&Go Home"
.TooltipText = "HOME (Alt-G)"
.OnAction = "GoHome"
End With
Set button2 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button2
.FaceId = 442
.Style = msoButtonIconAndCaption
.Tag = "All"
.Caption = "View &All"
.TooltipText = "View all columns (Alt-A)"
.OnAction = "AC_ViewAllCols"
End With
Set button3 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button3
.FaceId = 444
.Style = msoButtonIconAndCaption
.Tag = "Detail"
.Caption = "View &Cost"
.TooltipText = "View just the cost detail
columns. (Alt-C)"
.OnAction = "AC_ViewCostDetail"
End With
Set button4 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button4
.FaceId = 445
.Style = msoButtonIconAndCaption
.Tag = "Summary"
.Caption = "View &Summary"
.TooltipText = "View just the summary columns.
(Alt-S)"
.OnAction = "AC_ViewSummary"
End With
Set button5 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button5
.FaceId = 295
.Style = msoButtonIconAndCaption
.Tag = "Add&Rows"
.Caption = "Add &Row(s)"
.TooltipText = "Add the number of rows selected
at the selection point. (Alt-R)"
.OnAction = "AC_AddRows"
End With
Set button6 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button6
.FaceId = 293
.Style = msoButtonIconAndCaption
.Tag = "DelRows"
.Caption = "De&lete Row(s)"
.TooltipText = "Delete the rows selected. (Alt-
L)"
.OnAction = "AC_DelRows"
End With
Set button7 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button7
.FaceId = 1763
.Style = msoButtonIconAndCaption
.Tag = "AC_EditPKG"
.Caption = "Edit &Pkg"
.TooltipText = "Add, Delete or Change Packaging
Items. (Alt-P)"
.OnAction = "AC_EditPKG"
End With
Set button8 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button8
.FaceId = 1020
.Style = msoButtonIconAndCaption
.Tag = "AC_SortRows"
.Caption = "Sort Ite&ms"
.TooltipText = "Sort the items. (Alt-M)"
.OnAction = "AC_SortRows"
End With
TB_AlaCarte.Top = 90
TB_AlaCarte.Left = 200
TB_AlaCarte.Height = TB_AlaCarte.Height * 1.5
TB_AlaCarte.Visible = True
Set button1 = Nothing
Set button2 = Nothing
Set button3 = Nothing
Set button4 = Nothing
Set button5 = Nothing
Set button6 = Nothing
Set button7 = Nothing
Set button8 = Nothing
Set TB_AlaCarte = Nothing
End Sub
Is there something different in Excel 2003 with regard to
creating a commandbar? The code below works fine with
Excel 2000 and 2002, but fails where indicated below with
Excel 2003 (It's been reported on 2 machines so far).
Best Regards,
Walt
NOTES:
1) I may have to advance the timing when I buy Excel 2003.
2) I don't specify the MenuBar argument since its default
is False and that's what I want.
3) Please forgive the text wrap.
**********************
Sub ResetBars()
For Each bar In Application.CommandBars
If Not bar.BuiltIn And bar.Name <> "MyBar" Then
bar.Delete
Next
End Sub
'******** A LA CARTE ENTRY SCREEN TOOL BAR ************
Sub FloatingAlaCarteToolBar()
If NoToolBar = True Then Exit Sub
Call ResetBars
'WORKS IN EXCEL 2000 & 2002, BUT FAILS HERE IN EXCEL 2003
Set TB_AlaCarte = CommandBars.Add(Name:=" ",
Position:=msoBarFloating, Temporary:=True) '<<<<<<<<
Set button1 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button1
.FaceId = 1016
.Style = msoButtonIconAndCaption
.Tag = "Home"
.Caption = "&Go Home"
.TooltipText = "HOME (Alt-G)"
.OnAction = "GoHome"
End With
Set button2 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button2
.FaceId = 442
.Style = msoButtonIconAndCaption
.Tag = "All"
.Caption = "View &All"
.TooltipText = "View all columns (Alt-A)"
.OnAction = "AC_ViewAllCols"
End With
Set button3 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button3
.FaceId = 444
.Style = msoButtonIconAndCaption
.Tag = "Detail"
.Caption = "View &Cost"
.TooltipText = "View just the cost detail
columns. (Alt-C)"
.OnAction = "AC_ViewCostDetail"
End With
Set button4 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button4
.FaceId = 445
.Style = msoButtonIconAndCaption
.Tag = "Summary"
.Caption = "View &Summary"
.TooltipText = "View just the summary columns.
(Alt-S)"
.OnAction = "AC_ViewSummary"
End With
Set button5 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button5
.FaceId = 295
.Style = msoButtonIconAndCaption
.Tag = "Add&Rows"
.Caption = "Add &Row(s)"
.TooltipText = "Add the number of rows selected
at the selection point. (Alt-R)"
.OnAction = "AC_AddRows"
End With
Set button6 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button6
.FaceId = 293
.Style = msoButtonIconAndCaption
.Tag = "DelRows"
.Caption = "De&lete Row(s)"
.TooltipText = "Delete the rows selected. (Alt-
L)"
.OnAction = "AC_DelRows"
End With
Set button7 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button7
.FaceId = 1763
.Style = msoButtonIconAndCaption
.Tag = "AC_EditPKG"
.Caption = "Edit &Pkg"
.TooltipText = "Add, Delete or Change Packaging
Items. (Alt-P)"
.OnAction = "AC_EditPKG"
End With
Set button8 = TB_AlaCarte.Controls.Add
(Type:=msoControlButton)
With button8
.FaceId = 1020
.Style = msoButtonIconAndCaption
.Tag = "AC_SortRows"
.Caption = "Sort Ite&ms"
.TooltipText = "Sort the items. (Alt-M)"
.OnAction = "AC_SortRows"
End With
TB_AlaCarte.Top = 90
TB_AlaCarte.Left = 200
TB_AlaCarte.Height = TB_AlaCarte.Height * 1.5
TB_AlaCarte.Visible = True
Set button1 = Nothing
Set button2 = Nothing
Set button3 = Nothing
Set button4 = Nothing
Set button5 = Nothing
Set button6 = Nothing
Set button7 = Nothing
Set button8 = Nothing
Set TB_AlaCarte = Nothing
End Sub