问:每当加载我的外接程序时,Excel总是抛出以下错误(运行时错误49,不良的DLL调用约定)

尽管绝对没有外部DLL引用,但每次都会弹出对话框,但没有指示错误在哪里。
或
每次保存特定代码行时,Excel都会崩溃。
怎么解决这个问题呢?
发布于 2013-04-02 07:49:54
此错误可能是由于编译器错误而发生的。对此,最简单的解决方案是进行一个小的代码更改并重新编译。我通常做的是,
1 ->将Private Enum类型添加到加载项中任何模块的顶部。
Private Enum Something
member = 1
End Enum2 -> 编译加载项
3 ->重启excel
4 ->删除所做的代码更改。这已经没有必要了。
发布于 2014-09-20 00:15:29
- Carefully check all parameter-argument and return value types and assignment statements, especially for routines that you have been recently working on. If any are Variant-valued functions, explicitly type-cast to the correct type for the assignment.
- If the above situation is unavoidable due to using the Application.Run method to call a routine in a different workbook (for which you have no control over the parameter definitions), as a result of the Application.Run method passing all arguments ByVal, then, if the containing routine is a Sub, try converting it to a Function with no specified return type. This seems to force a clean-up of the stack and suppresses the error condition being thrown at a higher level in the call-stack.
- Explicit recompile the project.
- Save the file and close it.
- Re-open the file and re-run the code.
发布于 2016-04-19 13:42:07
或者,最好的选择:
-重写例程的名称.
-然后重新编译!
你现在可以走了!
https://stackoverflow.com/questions/15758834
复制相似问题