Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EOleSysError Exception with Invalid Argument Type

21 views
Skip to first unread message

Fritz

unread,
Nov 18, 2007, 5:49:32 AM11/18/07
to
Hello,

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.

Stew

unread,
Nov 20, 2007, 10:51:32 AM11/20/07
to
Fritz wrote:
> Hello,
>
> 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

Use a WideString instead;

WideString slDocument =

"e:\\Programme\\Borland\\CBuilder5\\Projects\\worda\\tweaksnq.doc";

Stewart

0 new messages