Robert Berke
asked on
SOLVED Vba error 49 "Bad DLL calling convention"
This error caused me fits when my Outlook 2010 vba program called a function. The function would work, and return the correct value but the "end function" command raised err 49 "Bad DLL calling convention".
Recompiling and rebooting did not fix the problem. But any change to the function does solve the problem. For instance, a single extra space between "end" and
"function" was enough to solve the problem.
Just to be on the safe side, I did a global change to both <end sub> and <end function>.
My code is now working again.
A a side note: I had earlier tried changing <a> to <a> with match case = true then recompiled. That DOES NOT solve the problem. Apparently vba was smart enough to notice that it did not really make any changes.
Also, since I don't know what caused the error, I left the logic to alert me to future occurrences.
Recompiling and rebooting did not fix the problem. But any change to the function does solve the problem. For instance, a single extra space between "end" and
"function" was enough to solve the problem.
Just to be on the safe side, I did a global change to both <end sub> and <end function>.
My code is now working again.
A a side note: I had earlier tried changing <a> to <a> with match case = true then recompiled. That DOES NOT solve the problem. Apparently vba was smart enough to notice that it did not really make any changes.
Also, since I don't know what caused the error, I left the logic to alert me to future occurrences.
on error resume next
countImports = ImportClientYmail()
If Err = 49 Then Call msgFastBox(1107, "Minor error. Please tell Bob we are getting " & Error, 15000)
On Error GoTo 0
The msgFastBox Shells to msgfastbox.exe so the error message is asynchronous and does not interfere with further Outlook processing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.