Getting XLL full path using ExcelX

Sep 10, 2013 at 5:33 AM
Hi!
I try to get XLL full path with code:
static XLOPERX xDLL;     
ExcelX(xlGetName, xDLL);
ExcelX(xlcAlert, xDLL);
But I get error: Excel returned invalid OPER structure.
How to get it correct? Thanks
Sep 10, 2013 at 6:08 AM
Solved!
static OPERX oGetName(Excel<XLOPERX>(xlGetName));
static std::wstring name_(oGetName.val.str + 1, oGetName.val.str[0]);
ExcelX(xlcAlert, OPERX(name_.c_str()));
Coordinator
Sep 10, 2013 at 11:32 AM
You seem to have a basic misunderstanding of the difference between XLOPER's and OPER's, and Excel4/Excel12 vs ExcelX.

The documentation should make all of this clear to you if you were conscientious enough to read it.

BTW, your solution only works in Excel 2007 and later. ExcelX(xlcAlert, ExcelX(xlGetName)) is shorter and more portable.