PC Review


Reply
Thread Tools Rate Thread

Automation error with XLA addin, fails on commandbarbutton onaction

 
 
haydnlj@gmail.com
Guest
Posts: n/a
 
      13th Aug 2007
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, Before:=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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does 2007 Office VBE Editor CommandBarButton .OnAction Property wo =?Utf-8?B?Zmdyb3Nl?= Microsoft Excel Programming 1 2nd Aug 2007 05:50 PM
Unshimmed Automation Addin and Shimmed COM Addin in same App Domai =?Utf-8?B?QnJhbmRvbg==?= Microsoft Excel Programming 0 27th Jun 2006 11:18 PM
Outlook Addin CommandBarButton Click Event Not Firing =?Utf-8?B?U3R1?= Microsoft Outlook Program Addins 0 17th Jan 2006 02:10 AM
VB6 COM addin for Outlook - CommandBarButton problem R Avery Microsoft Outlook VBA Programming 2 17th Sep 2004 09:30 PM
CommandBarButton.OnAction prop fires when set? Arg! kevin Microsoft Excel Programming 2 22nd Jul 2003 10:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:44 PM.