Board index » cppbuilder » A OleServer(Excel, Word...) in the thread

A OleServer(Excel, Word...) in the thread


2003-10-29 06:41:03 PM
cppbuilder15
How can I use the OleServer like as Excel, Word... in the thread?
For example, my code is:
void __fastcall TThreadExcel::thrExcel()
{
CoInitialize(NULL);// or CoInitialize(NULL, COINIT_...);
ExcelApplication->Connect();
....
ExcelWorksheet->...->set_FormulaR1C1(TVariant(...));
...
CoUninitialize();
}
But after executing this code I loose the control on ExcelApplication object. How can I still keep the control on one?
Best regards
Bye from XXXX@XXXXX.COM
 
 

Re:A OleServer(Excel, Word...) in the thread

Quote
How can I use the OleServer like as Excel, Word... in the thread?
For example, my code is:

void __fastcall TThreadExcel::thrExcel()
{
CoInitialize(NULL);// or CoInitialize(NULL, COINIT_...);
ExcelApplication->Connect();
....
ExcelWorksheet->...->set_FormulaR1C1(TVariant(...));
...
CoUninitialize();
}

But after executing this code I loose the control on>ExcelApplication object. How can I still keep the control on>one?
The problem has expired.
Best regards
Bye from XXXX@XXXXX.COM