title: Delphi Excel COM-Addin
body: <p>I am writting an MS Excel COM-Addin in Delphi 2006.  I'm have Excel 2007 installed on my development machine.</p>
  
  <p>I started the project as an ActiveX Library and then added an Automation object from the Delphi ActiveX project menu.  </p>
  
  <p>In my automation object I defined the IDTExtensibility2 interface as </p>
  
  <pre><code>IDTExtensibility2 = interface(IDispatch)
    ['{32E456FC-C710-43AA-9ACA-DDE8F132B91B}']
    function OnAddinsUpdate(var w_Custom: OleVariant): HResult; stdcall;
    function OnBeginShutDown(var w_Custom: OleVariant): HResult; stdcall;
    function OnConnection(const w_Application: IDispatch; w_ConnectMode: Integer;
                        const w_AddInInst: IDispatch; var w_Custom: OleVariant): HResult; stdcall;
    function OnDisconnection(w_DisconnectMode: Integer; var w_Custom: OleVariant): HResult; stdcall;
    function OnStartupComplete(var w_Custom: OleVariant): HResult; stdcall;
  end;
  </code></pre>
  
  <p>and implemented the interface in a class that derived from TAutoObject.</p>
  
  <p>In the initialization section of the unit I call</p>
  
  <pre><code>TAutoObjectFactory.Create(ComServer, TPBSExcelAddin, Class_PBSExcelAddin, ciSingleInstance, tmApartment);
  </code></pre>
  
  <p>com object registers fine and shows up in Excel Addin options however it will in install in excel.  I just get the error "Not loaded. An error has occurred during the loading of the COM Addin"</p>
  
  <p>Can anyone see a problem with my interface? or the way I am creating the com object? is there a way to debug this?</p>
  
  <p>Thank you</p>