Good morning, fellows developers:
I am currently trying to fix several performance issues for the Excel extended add-in inherited from a previous developer, basically I am trying to find how the add-in works inside Excel, that is, I was looking for a network for information, I understand:
- The value of 3 must be set in the LoadBehavi registry
- An Excel workbook must preload all add-ins specified in a VBA project during an open event
- After opening the document, my add-in should be available for use with VBA code.
Now I am adding Log4Net to the add-in and, oddly enough, I saw the following behavior
There is a global variable in an Excel workbook during an open event
Public myAddin As Object
Set myAddin = New TradingAddin.TradingAddin
Thus, the C # class Contractor is called.
, IDTExtensibility2 OnConnection, OnDisconnection .. , .
, Excel , VBE, -
Set myAddin = Application.COMAddins.Item("Trading").Object
Nothing , #, Excel.
:
- Visual Studio 2005 Team Edition, - Excel 2003, - . VSTO.
, VBA,
Set addIn = Application.COMAddIns.Item("K2Trading.K2Trading").Connect
Set managedObject3 = addIn.Object <
Set addIn = Application.COMAddIns("K2Trading.K2Trading").Connect
, LoadBehaviour 3 2, , OnConnection Extensibility, OnDisconecction Object Class Constructor, VBA , , VBA , COM-????
ProcMon, Excel ( ) http://blogs.msdn.com/dvespa/archive/2008/10/15/troubleshooting-outlook-com-addins-using-procmon.aspx.
, , , ?
, COM- ? , , COM-?
,
:
, Unspecified error ( HRESULT: 0x80004005 (E_FAIL))
public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode,
object addInInst, ref System.Array custom)
{
object missing = System.Reflection.Missing.Value;
try
{
if (debug)
{
log.Debug("Connection Mode :" + connectMode);
}
this.excelApp = (Excel.Application)application;
this.addInInstance = addInInst;
Office.COMAddIn addIn = this.excelApp.COMAddIns.Item(ref addInInst);
VBA.Interaction.CallByName(addIn, "Object", VBA.CallType.Let, this);
^
|
The Exception occurs here.
, ,
public void OnConnection(
object application,
Extensibility.ext_ConnectMode connectMode,
object addInInst,
ref System.Array custom)
{
VBA.Interaction.CallByName(addInInst, "Object", VBA.CallType.Let, this);
}
addInInst Office.COMAddin, ,
Object ,
, Excel , , , Excel, OnConnection , = AvgCost ( )
?