1

When I write VBA code, I tend to cut and paste variable names or other bits of code. This results in frequent syntax check errors that result in the message box popping up. That's annoying, and I'm aware that I can turn it off via Tools > Options > Editor > uncheck Auto Syntax Check.

This doesn't seem to prevent the VBA editor from actually checking my line - it still turns red. I don't mind that behavior, because it doesn't interrupt anything. And it does let me know if I do, in fact, have some sort of problem after I'm done with the line, which is nice. Unfortunately, I'm not always smart enough to diagnose the error on my own, and the text in the message box is actually helpful. But I've turned off the message box!

Is there a way for me to display that error, short of temporarily turning the message box on?

4

2 回答 2

4

您可以使用 编译,Debug>Compile这将显示相​​同的消息。如果有多个编译错误,您可能必须先处理该错误。

于 2013-08-19T21:43:53.077 回答
1

此评论适用于 Mac 上的 Visual Basic for Excel 用户。

我在 Excel 版本 16.14.1(截至 2018 年 7 月的最新版本)中使用 Visual Basic,作为 iMac Pro 上运行 High Sierra 的 Office 365 的一部分。

在 Visual Basic 编辑器的 Tools 选项卡下,只有三个选项:

  1. 参考...
  2. 宏......
  3. VBA 项目属性......

这些子菜单都不会导致“选项”,也不会导致您打开和关闭“自动语法检查”的任何内容

相反,可以在 Excel ==> 首选项选项卡中找到该选项。然而。选中或取消选中该框不会改变行为。在这两种情况下,文本都会在语法错误时变为红色,但在这两种情况下都不会出现烦人的弹出窗口。

于 2018-07-08T05:35:14.250 回答