Problem with Excel executing function called from XLL

Oct 13, 2014 at 2:15 AM

I have a macros in VBA which calls complex code (function) in XLL. This XLL function calls another function in VBA reading some data from the sheet. When I try to do this Excel throws an error "Cannot run the macro xxxx".

Any ideas how to solve this issue ?

*Interesting enough when this XLL function is used as UDF in a cell it works fine. I do not want to do this as asynchronous workaround since by logic I just need serial execution.

**I am using XlCall.Excel(XlCall.xlUDF, "Myfunc") to call it from VB.NET. Tried to play with ismacrotype=true and other xl qualifiers with no luck although my knowledge in this subject is minimal.
Oct 14, 2014 at 8:13 AM
Maybe you can make a little sample project that has all the different bits you're trying to hook together?
Then I can try to understand where it's going wrong.

Oct 17, 2014 at 4:32 AM
I found the solution. Apparently when XLL function is called from cell as UDF you do not need to supply workbook name for callbacks using XlCall.Excel but if you call XLL from VBA macros workbook name has to be passed along.

*ExcelDNA is really a good package and no troubles with COM, registration, admin rights and so on, although it takes some time to figure out how to integrate all pieces (VBA-DNA-VS) together.