VBA: Custom Toolbar help

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
------------------------------------------------
 
J

JE McGimpsey

hedonists said:
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.

See my reply to your previous post.

In general, it's best not to repost problems, but to simply reply to the
original thread.

That way you don't waste the time of those answering a question that has
already been answered, and everyone can see previous answers to see what
has or hasn't worked.

Obviously if you're not getting an answer, re-posting is appropriate,
but you should allow some time to pass.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top