Board index » cppbuilder » Using Variant in driving excel (Ole component)

Using Variant in driving excel (Ole component)


2006-08-29 08:50:09 PM
cppbuilder99
Hello,
I've to use Variant in my program to drive an ole apllication (Excel)
So if i write
Variant vRange,vCell,vSheetName,vWorksheet
AnsiString sTemp; .
....
vRange="A1";
vCell=vWorksheet.OlePropertyGet("Range",vRange);
there is no problem
If I write
.....
sTemp="A1";
vRange=sTemp
vCell=vWorksheet.OlePropertyGet("Range",vRange);
I get the next error EoleSysError
Can anybody say me how to pass the right value through a local variable?
Thank your
 
 

Re:Using Variant in driving excel (Ole component)

"Didier" < XXXX@XXXXX.COM >wrote:
Quote
Hello,
I've to use Variant in my program to drive an ole apllication (Excel)
This has nothing to do with the C++ language per se - try posting to
borland.public.cppbuilder.activex instead.
Alan Bellingham
--
ACCU Conference: 11-14 April 2007 - Paramount Oxford Hotel
 

Re:Using Variant in driving excel (Ole component)

Didier wrote:
Quote
vRange="A1";
AnsiString sTemp="A1";
vRange=sTemp

Can anybody say me how to pass the right value through a local variable?
The only difference is the one that "doesn't work" is using an
AnsiString instead of a cstring.
Try
vRange=sTemp.c_str();
For a more difinitive answer, follow Alan's advice.
 

{smallsort}