Board index » cppbuilder » Excel TLB Problem

Excel TLB Problem

Please, don't post in HTML, as this is against the guidelines governing
this news server.
As for the error, I don't know why it appears. Also, you have an error
in your code. You never want to delete an interface like that. You
either use a smart interface wrapper ( like WorkbookPtr wb; also use
WorkbooksPtr ) or you call wb->Release();


> Charles de Jager wrote:


Re:Excel TLB Problem

Hi all
I have done what all the people/manuals said and I am still not having much luck.
When I run the included code snippet I get the following error message
    'this->Add(Template,lcid,(Excel_tlb::WorkbookPtr*)&RHS); Object is not connected to server

Here is the code snippet:

#include <Excel_TLB.h>
TCOM_Application xlApp;Workbooks *wbs;Workbook *wb;

void __fastcall TForm1::Button1Click(TObject *Sender){   CoInitialize(NULL);   xlApp = CoApplication_::Create();   xlApp.set_Visible(0,true);   wbs = xlApp.get_Workbooks();   if ( wbs ) {      wb = wbs->Add();      if ( wb ) {         delete wb;      }      delete wbs;   }   xlApp.Quit();}

Can anybody please point me in the right direction.

Other Threads