Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
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 custom toolbar / DSOFramer Zachary Turner Excel Programming 0 July 2nd 04 04:59 PM
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! Kevin Waite Excel Programming 2 March 3rd 04 03:31 PM
How can I get into VBA for a custom toolbar - Excel 97 Jody[_4_] Excel Programming 5 November 6th 03 05:39 PM
saving toolbar buttons on custom toolbar Paul James Excel Programming 12 August 6th 03 08:28 AM


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