c++exceladd-inxll

"addin.XLL is in a different format" issue, cannot open the xll I created by myself


I wrote a very simple xll file in VC++ 2010, and the Excel I am using is Excel 2007. The library contains only one function:

extern "C" LPXLOPER12 WINAPI tsMkErr() {
    static XLOPER12 x;
    x.xltype = xltypeErr;
    x.val.err = xlerrNull;
    return &x;
}

and the necessary xlAutoOpen function. I compiled and dll file, change the name to xll, and double click it to open in Excel. Everything works just as I expected.

However, if I am trying to open this file on another PC, the Excel just keeps telling me that:

The file you are trying to open, '.xll', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

When I click yes, garbage pops out.

I also tried to load it via Add-in Manager. In this case I can open the file, but cannot find my function tsMkErr().

I would be grateful to all suggestions ...

btw, I don't really know how to choose a reply as an answer. If you know how to do it, please also let me know :)

... I am going to publish my tool this week ... now I just realized it only works on my PC ... please help ... T_T


Solution

  • Do yourself a favor and use XLL: https://github.com/xlladdins/xll