Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SOS: Excel custom Toolbar
Hi,
I created a custom Excel Toolbar with VBA. It worked in Windows Excel, but the buttons failed to load in Mac Excel. The error message says Run-time error '-2147483640(-7FFFFFF8)': Method 'FaceId' of object 'CommandBarButton' failed If I comment out the .FaceId = 642 Then the error message becomes Method 'OnAction' of object 'CommandBarButton' failed 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 ------------------------------------------------ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I set up a custom toolbar in Excel 2007? | Excel Discussion (Misc queries) | |||
Excel custom toolbar / DSOFramer | Excel Programming | |||
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! | Excel Programming | |||
How can I get into VBA for a custom toolbar - Excel 97 | Excel Programming | |||
saving toolbar buttons on custom toolbar | Excel Programming |