VBA解析器编译错误:未定义子或函数

时间:2022-11-06 09:40:13

I am using office 365 for Mac, with version number 15.32.

我在Mac上使用office 365,版本号为15.32。

I repeatedly get the "compile error: sub or function not defined" when I try to run the macro that is trying to implement a solver function, which was a previously recorded macro (so I know it is correct). The error highlights the "SolverOk" part of the code.

当我试图运行试图实现求解器函数的宏时,我反复得到“编译错误:sub或function未定义”,这是一个先前记录的宏(因此我知道它是正确的)。这个错误突出显示了代码的“SolverOk”部分。

I understand that this often occurs when the reference to Solver.xlam is not present, however I have no idea how to do this on the Mac if this is truly the issue. Attached is a screenshot of what I am trying to achieve. Does the Solver.xlam thing on the left indicates that it is there? If so, do you have any idea what the problem is?

我知道这经常发生在提到求解器的时候。xlam没有出现,但是我不知道如何在Mac上实现这一点,如果这真的是一个问题的话。附件是我正在努力实现的一个截屏。解算器。左边的xlam表示它在那里?如果是的话,你知道问题出在哪里吗?

Screenshot of available references

截图可用的引用

Screenshot of error + VBA code

错误+ VBA代码的屏幕截图

1 个解决方案

#1


1  

Open File/Options/Add-Ins

打开文件/选项/插件

On the page with the add ins, click on the bottom "Manage Excel Add-Ins" .. "Go..." and look for SOLVER related Add-ins there.

在添加插件的页面上,单击底部的“管理Excel插件”。“去…”,在那里寻找解决方案相关的插件。

Once these are activated, return to VBA (Alt-F11) and then the "SOLVER" option should be available in Tools/References, where you want to Add it.

一旦这些被激活,返回到VBA (Alt-F11),然后“求解器”选项应该在工具/引用中可用,您希望在其中添加它。

#1


1  

Open File/Options/Add-Ins

打开文件/选项/插件

On the page with the add ins, click on the bottom "Manage Excel Add-Ins" .. "Go..." and look for SOLVER related Add-ins there.

在添加插件的页面上,单击底部的“管理Excel插件”。“去…”,在那里寻找解决方案相关的插件。

Once these are activated, return to VBA (Alt-F11) and then the "SOLVER" option should be available in Tools/References, where you want to Add it.

一旦这些被激活,返回到VBA (Alt-F11),然后“求解器”选项应该在工具/引用中可用,您希望在其中添加它。