Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automation error with XLA addin, fails on commandbarbutton onaction

Hello,

I have a series of procedures in a file named auto.xla. The
workbook_open() procedure runs the below code, and effectively adds a
custom menu to the users main menu. It has mysteriously stopped
working, stepping through this code presents a Run-Time error
'-2147467259 (80004005)' suggesting the 'OnAction' of
object'_commandbarbutton' failed. The strange part is that if I copy
this workbook and create a file named auto_2.xla for example, this
opens and executes as expected.

The code bugs out on line 26, the first OnAction method. As discussed
this was working just fine, any help would be appreciated.


Private Sub Workbook_Open()

With Application.CommandBars("Worksheet Menu Bar")

If .Controls.Item(1).Caption = "[ CUSTOM MENU ]" Then
.Controls.Item(1).Delete
End If

Set cp = .Controls.Add(Type:=msoControlPopup, Befo=1,
Temporary:=True)
End With
cp.Caption = "[ CUSTOM MENU ]"
i = 0
Application.CommandBars("Worksheet Menu
Bar").Controls("File").BeginGroup = True

With cp.Controls

i = i + 1
Set cp2 = .Add(Type:=msoControlPopup, Temporary:=True)
.Item(i).Caption = "Internal Quoting"
With cp2.Controls
t = i

i = 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "Eclipse - Quote"
.Item(i).OnAction = "Eclipse_To_Quote"
.Item(i).FaceId = 2671

i = i + 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "Quote - Excel"
.Item(i).OnAction = "QP_TO_Excel"
.Item(i).FaceId = 317

i = t
End With

i = i + 1
Set cp2 = .Add(Type:=msoControlPopup, Temporary:=True)
.Item(i).Caption = "Direct Quoting"
With cp2.Controls
t = i

i = 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "Quote Search"
.Item(i).OnAction = "quote_lookup"
.Item(i).FaceId = 558
.Item(i).BeginGroup = True

i = i + 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "Control„˘"
.Item(i).OnAction = "Create_fControl"
.Item(i).FaceId = 3251

i = i + 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "System„˘"
.Item(i).OnAction = "M_Quotes"
.Item(i).FaceId = 3251
.Item(i).BeginGroup = True

i = i + 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "CVault"
.Item(i).OnAction = "CV_Quotes"
.Item(i).FaceId = 3251

i = t
End With

i = i + 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "Margin Calculator"
.Item(i).OnAction = "mycalcshow"
.Item(i).FaceId = 283
.Item(i).BeginGroup = True

i = i + 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "Integration Build"
.Item(i).OnAction = "integration_build"
.Item(i).FaceId = 627

i = i + 1
.Add Type:=msoControlButton, Temporary:=True
.Item(i).Caption = "Quick Typer"
.Item(i).OnAction = "Quick_Typer"
.Item(i).FaceId = 3479

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
Does 2007 Office VBE Editor CommandBarButton .OnAction Property wo fgrose Excel Programming 0 August 2nd 07 03:54 AM
Unshimmed Automation Addin and Shimmed COM Addin in same App Domai Brandon Excel Programming 0 June 27th 06 11:18 PM
Setting OnAction Property Fails Josh Sale Excel Programming 13 August 31st 05 09:02 PM
.ONACTION macro call fails Wayne Excel Discussion (Misc queries) 2 March 2nd 05 05:10 PM
CommandBarButton.OnAction prop fires when set? Arg! kevin Excel Programming 2 July 22nd 03 10:40 AM


All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"