I am attempting to call a C++ DLL from Excel-VBA.
I know the DLL function is being executed as I inserted fputs() logging calls to track execution and the stamps are showing up in my log file. The problem is, whenever the DLL function returns, I get Error 49.
Here is the declaration in VBA:
Private Declare Function InitMCR Lib "MCRBoilerplate.dll" Alias "?initMCR@@YGXXZ" ()
and here is the declaration in C++
__declspec(dllexport) void __stdcall initMCR() { ... }
Why am I getting this Error 49 behavior, even though the DLL calls appear to be working?
saveto get intermediate versions of your edits backed up here (SO backs up your drafts while you're editing after a certain time). As soon you clicksave, you're publishing your stuff, and you may receive downvotes and critique about your actually unfinished stuff. Sorry for the initial down/close votes, you're welcome in general. Put your solution as an answer as suggested, and I'd even upvote both of it.