I'm just migrating from BCB5 to BCB6. When I compile and run
applications that use OLE automization (MS Word or MS Excel), I get an
EOleSysError Exception when opening a document or a worksheet, telling
that an invalid argument type is used. In both cases, the arguments are
AnsiStrings, which used to be valid and works fine with BCB5.
The coding is:
(Word2000)
AnsiString slDocument =
"e:\\Programme\\Borland\\CBuilder5\\Projects\\worda\\tweaksnq.doc";
Variant vOLEWord = CreateOleObject("Word.Application");
Variant vDocuments = vOLEWord.OlePropertyGet("Documents");
Variant vWDocument = vDocuments.OleFunction("Open", slDocument);
(Excel97)
String excelWorkbook = FileListBox1->FileName;
Variant var_mExcel=CreateOleObject("Excel.Application");
Variant var_mBook = var_mExcel.OlePropertyGet("Workbooks")
.OlePropertyGet("Open", excelWorkbook);
Searching the WEB, I found some incidents describing similar problems,
but no solution (althoug when changing slDocumnents to slDocuments.c_str()).
Any idea? Regards, Fritz
p.s.: If this is the wrong forun for my problem, please let me know.
Use a WideString instead;
WideString slDocument =
"e:\\Programme\\Borland\\CBuilder5\\Projects\\worda\\tweaksnq.doc";
Stewart