🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.migration
2 messages
2 total messages Started by Fritz Sun, 18 Nov 2007 10:49
EOleSysError Exception with Invalid Argument Type
#220
Author: Fritz
Date: Sun, 18 Nov 2007 10:49
26 lines
2107 bytes
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.
Re: EOleSysError Exception with Invalid Argument Type
#221
Author: Stew
Date: Tue, 20 Nov 2007 15:51
15 lines
1369 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads