S
Somashekhar
Hi,
I am using excel's OLE automation and COM to display
widechar strings on excel. When I send a Variant of type
BSTR and BSTR value "TRUE", or "100", "FALSE", etc. to
display on excel sheet, excel automatically converts it to
type binary or number. If I read the same cell, I get back
the Variant of type boolean or int. Is there a way to turn
this "OFF".
If I use Excel SDK then these strings get displayed
perfectly without any conversion. Is there something I am
missing ? A code sample would be helpful.
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = SysAllocString("TRUE");
dispidPut = DISPID_PROPERTYPUT;
dispparams.cArgs = 1;
dispparams.rgvarg = &var;
dispparams.cNamedArgs = 1;
dispparams.rgdispidNamedArgs = &dispidPut;
// Invoke PropertyPut
//pDispRange is handle to range object
hr = pDispRange->Invoke(dispidValue, IID_NULL,
LOCALE_USER_DEFAULT,DISPATCH_METHOD | ISPATCH_PROPERTYPUT,
&dispparams,NULL, &excep, &uiArgErr));
Thanks,
Som
I am using excel's OLE automation and COM to display
widechar strings on excel. When I send a Variant of type
BSTR and BSTR value "TRUE", or "100", "FALSE", etc. to
display on excel sheet, excel automatically converts it to
type binary or number. If I read the same cell, I get back
the Variant of type boolean or int. Is there a way to turn
this "OFF".
If I use Excel SDK then these strings get displayed
perfectly without any conversion. Is there something I am
missing ? A code sample would be helpful.
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = SysAllocString("TRUE");
dispidPut = DISPID_PROPERTYPUT;
dispparams.cArgs = 1;
dispparams.rgvarg = &var;
dispparams.cNamedArgs = 1;
dispparams.rgdispidNamedArgs = &dispidPut;
// Invoke PropertyPut
//pDispRange is handle to range object
hr = pDispRange->Invoke(dispidValue, IID_NULL,
LOCALE_USER_DEFAULT,DISPATCH_METHOD | ISPATCH_PROPERTYPUT,
&dispparams,NULL, &excep, &uiArgErr));
Thanks,
Som