When editing Microsoft Office VBA, how can I disable the popup "Compile error" messages?

VbaEditor

Vba Problem Overview


When you're editing a Microsoft Office VBA macro or function, you will often move your cursor from a line that you haven't finished. For example, to go copy something you want to paste into that line. But, if that partial line isn't syntactically valid, the VBA editor interrupts your work by popping up a "Compile error" message that has to be dismissed.

Is there any way to disable the message box? I find it irritating...

(This happens with Excel Visual Basic for Applications, Outlook VBA, Word VBA, etc.)

Vba Solutions


Solution 1 - Vba

Do the following in your VBA editor window (entitled "Microsoft Visual Basic for Applications"):

Click the menu "Tools" and then "Options".

In the Options' "Editor" tab, uncheck the "Auto Syntax Check" box. (See screenshot, below.)

This change does not make the editor stop compiling in the background and marking syntax errors in red (or whatever formatting is specified in the Options tab "Editor Format").

MS Office programs share this common VBA editor, so if you change an option while editing VBA for Excel then you've changed it for Outlook, Word, etc.

MS VBA editor's Tools Options dialog box

Solution 2 - Vba

In the VBE, Tools - Options - Editor and uncheck Auto Syntax Check. It will turn bad code red, but won't give you the popup.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIain SView Question on Stackoverflow
Solution 1 - VbarayView Answer on Stackoverflow
Solution 2 - VbaDick KusleikaView Answer on Stackoverflow