为什么 VBA 编辑器有时会自行打开?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/472993/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 10:12:02  来源:igfitidea点击:

Why does the VBA Editor open on its own sometimes?

vbaoutlookoutlook-vbavbe

提问by Jo?o Silva

I created a script in Outlook 2003 VBA that watches for new appointments, and sets them to tentative and no reminder as I create them. I find that seemingly at random, the VBA editor will open itself. It doesn't happen when I use the new script, but it did happen this morning when I un-hibernated my laptop, for example.

我在 Outlook 2003 VBA 中创建了一个脚本,用于监视新约会,并在创建它们时将它们设置为暂定且没有提醒。我发现 VBA 编辑器似乎是随机打开的。例如,当我使用新脚本时不会发生这种情况,但是今天早上当我将笔记本电脑取消休眠时确实发生了这种情况。

The editor doesn't pop up any runtime errors or highlight any lines in the script, it's just there as if I had pressed Alt-F11 to launch it. Sometimes I close other apps and see that it's been sitting back there for a while.

编辑器不会弹出任何运行时错误或突出显示脚本中的任何行,就好像我按下了 Alt-F11 来启动它一样。有时我关闭其他应用程序并看到它已经在那里坐了一段时间。

This behavior has only been occurring since I created this new script. Any ideas why this would occur?

自从我创建这个新脚本以来,这种行为才发生。任何想法为什么会发生这种情况?

回答by Jo?o Silva

As stated in, Microsoft Support Center:

Microsoft 支持中心所述

"This problem occurs only if the Microsoft Visual Basic Editor window is maximized."

“仅当 Microsoft Visual Basic 编辑器窗口最大化时才会出现此问题。”

Solution:

解决方案:

Un-MaximizeVisual Basic Editor and closeit.

取消最大化Visual Basic 编辑器并关闭它。

And you are done!

你已经完成了!

回答by Fionnuala

If you have previously set breakpoints, it may be that you still have a phantom breakpoint. Try choosing "remove all breakpoints" and see if that clears the problem.

如果你之前设置了断点,那可能你还有幻像断点。尝试选择“删除所有断点”,看看是否能解决问题。

Check also that you have not chosen "Break on all errors" under options, and that your error handler is functioning properly.

还要检查您是否没有在选项下选择“中断所有错误”,以及您的错误处理程序是否正常运行。

回答by Fionnuala

Believe it or not, this is a known issue. Check out this MS Support link:

信不信由你,这是一个已知问题。查看此 MS 支持链接:

http://support.microsoft.com/kb/829059

http://support.microsoft.com/kb/829059

I have the same problem and found it while I was looking for a solution. Since it gives no advice, I kept searching and came across your post. I will come back with an update if I find a solution.

我有同样的问题,在寻找解决方案时发现了它。由于它没有提供任何建议,我一直在搜索并偶然发现了您的帖子。如果我找到解决方案,我会回来更新。

回答by Geoff

The MS page linked by Jaquez hints at the answer; just make sure you don't run the editor maximized, and the problem should go away. If you restore it to a non-maximized state, then resize it to take up the whole screen, it should remember its position. It's a pain if you only have a small screen, but on a normal large monitor it works fine, and solved the problem for me.

Jaquez 链接的 MS 页面暗示了答案;只要确保您没有最大化运行编辑器,问题就会消失。如果将其恢复到非最大化状态,然后调整其大小以占据整个屏幕,它应该记住其位置。如果你只有一个小屏幕会很痛苦,但在普通的大显示器上它工作正常,并为我解决了问题。

回答by Kanchan

My solution was to search for the .otmfile of my VBA project. It was stored under data\microsoft\outlook. I closed Outlook and deleted the .otmfile. Restarted Outlook and it was solved.

我的解决方案是搜索.otm我的 VBA 项目的文件。它存储在data\microsoft\outlook. 我关闭了 Outlook 并删除了该.otm文件。重新启动Outlook,问题解决了。

回答by Jon Fournier

I have the same problem, except that it only occurs when I've gone in and unlocked the VBA project for editing and haven't restarted Outlook. It seems to open up when I get a new email (that's when my VBA runs) so basically I just have to restart Outlook and lock the project back up.

我有同样的问题,除了它只在我进入并解锁 VBA 项目进行编辑并且没有重新启动 Outlook 时才会发生。当我收到一封新电子邮件(那是我的 VBA 运行时)时,它似乎会打开,所以基本上我只需要重新启动 Outlook 并锁定项目备份。

Sorry I don't know what's really causing it, but locking the VBA project should fix the problem...

抱歉,我不知道到底是什么原因造成的,但是锁定 VBA 项目应该可以解决问题...

回答by brl8

Just wanted to add that I was running into a phantom breakpoint issue with VBA in excel. Clearing all breakpoints did not work for me, but I resolved it as follows: Copy all content from offending module into a text file. Delete module. Re-create module. Copy back in all text. Save. Phantom breakpoint gone.

只是想补充一点,我在 excel 中遇到了 VBA 的幻影断点问题。清除所有断点对我不起作用,但我按如下方式解决了它:将有问题的模块中的所有内容复制到文本文件中。删除模块。重新创建模块。复制回所有文本。节省。幻影断点消失了。