Bonjour,
je cherche à utiliser la fonction "Intersect" d'excel en OLE Automation.
Pour cela j'aimerai utiliser la fonction AutoWrap mais je ne trouve pas :
- le nom de fonction qui fonctionne
- les bons arguments
- DISPATCH_PROPERTYPUT / DISPATCH_PROPERTYGET ou/et DISPATCH_METHOD
j'ai essayé ça :
//******************************************************************
bool MyExcel::IntersectTwoRanges (char *pRangeX, char *pRangeY)
{
if(pRangeX == NULL || pRangeY == NULL) return false;
WCHAR strX[100];
MultiByteToWideChar(CP_ACP, 0, pRangeX, -1, strX, 100);
WCHAR strY[100];
MultiByteToWideChar(CP_ACP, 0, pRangeY, -1, strY, 100);
VARIANT rangeX;
rangeX.vt = VT_BSTR;
rangeX.bstrVal = SysAllocString(strX);
VARIANT rangeY;
rangeY.vt = VT_BSTR;
rangeY.bstrVal = SysAllocString(strY);
AutoWrap(DISPATCH_METHOD, &cellRange, xlSheet.pdispVal, L"Intersect", 2, rangeX, rangeY);
SysFreeString(rangeX.bstrVal);
SysFreeString(rangeY.bstrVal);
VariantClear(&rangeX);
VariantClear(&rangeY);
return true;
}
//******************************************************************
Ça compile mais j’obtiens ce message à l’exécution :
"IDispatch::GetIDsOfNames("Intersect") failed ..."
c'est un message propre à "mon code (que j'ai copié d'internet) qui est généré quand : pDisp->GetIDsOfNames = FAILED
je me doute bien que je n'envoie pas le bon nom de fonction mais j'ai essayé un tat de trucs et je ne trouve pas.
Merci par avance pour l'aide que vous pourrez m'apporter,
Aymeric