Search code examples
excelxll

XLL being loaded into Excel like a Spreadsheet


I have built an XLL. When I load this XLL into Excel via the Excel Add-ins window, I can see the xlAutoOpen and xlAutoAdd methods being called. The add-in then works normally.

However, if I close and reopen Excel again, Excel loads the XLL into a spreadsheet, e.g. the title of the workbook is "DevAddIn.xll [Read-only]" and the first line is "Í!¸LÍ!This program cannot be run in DOS mode."

Does anyone know why I can successfully load the XLL, but then Excel seems to misinterpret the add-in when it is next loaded?


Solution

  • Tracked down the problem - Excel couldn't find some underlying libraries. These libraries are in the same directory as the XLL. I added the directory name to my path and the problem disappeared.

    I think that when I loaded Excel from Visual Studio, Visual Studio would provide the path to the libraries, so things would work properly. When I then tried to open XLL, the path wasn't present, so loading would fail.