H
hedonists
Hi,
I created a custom Excel Toolbar with VBA. It worked in Windows Excel, but
the buttons failed to load in Mac Excel. Can someone help me to find what is
wrong with the code?
Thank you very much.
---------------------------------------------
Private Sub CreateDesignToolbar()
Dim TBar As CommandBar
On Error Resume Next
Application.CommandBars("Lenses Design").Delete
On Error GoTo 0
Set TBar = Application.CommandBars.Add
With TBar
.Name = "Lenses Design"
.Protection = msoBarNoCustomize
.Position = msoBarFloating
.Visible = True
End With
Call AddDesignButton
End Sub
Sub AddDesignButton()
Set NewBtn1 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn1
.FaceId = 642
.OnAction = "ThisWorkbook.LensDesign"
.Caption = "Design"
.TooltipText = "Design aerodynamic lenses"
.Style = 3
End With
Set NewBtn2 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn2
.FaceId = 2174
.OnAction = "ThisWorkbook.OtherSizes"
.Caption = "More"
.TooltipText = "Examine other sizes"
.Style = 3
End With
Set NewBtn3 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn3
.FaceId = 688
.OnAction = "ThisWorkbook.Reset"
.Caption = "Reset"
.TooltipText = "Reset to default parameters"
.Style = 3
End With
Set NewBtn4 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn4
.FaceId = 49
' .OnAction = "ThisWorkbook.OtherSizes"
.Caption = "Help"
.TooltipText = "Help"
.Style = 3
End With
End Sub
------------------------------------------------
I created a custom Excel Toolbar with VBA. It worked in Windows Excel, but
the buttons failed to load in Mac Excel. Can someone help me to find what is
wrong with the code?
Thank you very much.
---------------------------------------------
Private Sub CreateDesignToolbar()
Dim TBar As CommandBar
On Error Resume Next
Application.CommandBars("Lenses Design").Delete
On Error GoTo 0
Set TBar = Application.CommandBars.Add
With TBar
.Name = "Lenses Design"
.Protection = msoBarNoCustomize
.Position = msoBarFloating
.Visible = True
End With
Call AddDesignButton
End Sub
Sub AddDesignButton()
Set NewBtn1 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn1
.FaceId = 642
.OnAction = "ThisWorkbook.LensDesign"
.Caption = "Design"
.TooltipText = "Design aerodynamic lenses"
.Style = 3
End With
Set NewBtn2 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn2
.FaceId = 2174
.OnAction = "ThisWorkbook.OtherSizes"
.Caption = "More"
.TooltipText = "Examine other sizes"
.Style = 3
End With
Set NewBtn3 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn3
.FaceId = 688
.OnAction = "ThisWorkbook.Reset"
.Caption = "Reset"
.TooltipText = "Reset to default parameters"
.Style = 3
End With
Set NewBtn4 = Application.CommandBars("Lenses
Design").Controls.Add(Type:=msoControlButton)
With NewBtn4
.FaceId = 49
' .OnAction = "ThisWorkbook.OtherSizes"
.Caption = "Help"
.TooltipText = "Help"
.Style = 3
End With
End Sub
------------------------------------------------