Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert selection variant idispatch to something useful
I have a C++ app that I am converting from using DDE to OLE Automation
to talk with Excel. Does anyone know how to convert a "selection" Variant of type VT_DISPATCH to something useful like a char string ? Thanks, Lynn McGuire |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert selection variant idispatch to something useful
Hi.
Could you tell me more about that? What inconvenience do you feel when you use VT_DISPATCH? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert selection variant idispatch to something useful
Could you tell me more about that?
What inconvenience do you feel when you use VT_DISPATCH? I have no idea how to convert the variant to char * strings: IDispatch *pDocApp; { VARIANT result; VariantInit ( & result); OLEMethod (DISPATCH_PROPERTYGET, & result, pXlApp, L"Application", 0); pDocApp = result.pdispVal; } IDispatch *pXlSelection; { VARIANT result; VariantInit ( & result); OLEMethod (DISPATCH_PROPERTYGET, & result, pDocApp, L"Selection", 0); pXlSelection = result.pdispVal; if (result.vt == VT_DISPATCH) { IDispatch *pDisp = result.pdispVal; // how to convert this idispatch pointer to char * strings now ??? } } Thanks, Lynn |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert selection variant idispatch to something useful
I have no idea how to convert the variant to char * strings:
Figured it out: { VARIANT result; VariantInit ( & result); OLEMethod (DISPATCH_PROPERTYGET, & result, pXlApplication, L"Selection", 0); if (result.vt == VT_DISPATCH) { IDispatch *pDisp = result.pdispVal; // this will get the contents of the selected cell // VariantInit ( & result); // OLEMethod (DISPATCH_PROPERTYGET, & result, pDisp, L"Value", 0); // int res_value = result.vt; // this will get the address of the selected cell VariantInit ( & result); OLEMethod (DISPATCH_PROPERTYGET, & result, pDisp, L"Address", 0); if (result.vt == VT_BSTR) selection = _bstr_t (result.bstrVal); pDisp - Release (); } } Thanks, Lynn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using created variant value to reference to a variant within my code | Excel Programming | |||
Convert values in a variant array to integer values | Excel Programming | |||
Excel iDispatch problem | Excel Programming | |||
different IDispatch in event handler | Excel Programming | |||
variant array containing cel adresses convert to actual ranges-array | Excel Programming |