> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Syntax Errors
- URL: https://nolongerset.com/syntax-errors/
- Published: 2021-08-06T02:36:36.000Z
- Updated: 2026-05-08T13:03:10.000Z
- Description: Every programming language has its own syntactical quirks. The C family loves braces. Python loves indentation. BASIC loves words. And Perl loves #%@!{}]&.
- Author: Mike Wolfe
- Tags: Bug Types, #Import 2026-05-20 02:59

*This is part 1 of a [7-part series](https://nolongerset.com/some-bugs-are-better-than-others/) comparing different kinds of software bugs.*

## What is a Syntax Error?

A syntax error is any invalid sequence of characters in your code that cannot be **parsed**. 

[Parsing](https://en.wikipedia.org/wiki/Parsing) (a.k.a. syntax analysis) is a rather deep topic in computer science. The first step in parsing most languages is to convert the individual characters into [lexical tokens](https://docs.microsoft.com/en-us/openspecs/microsoft%5Fgeneral%5Fpurpose%5Fprogramming%5Flanguages/ms-vbal/848bd0b2-e453-4f50-a42a-452eb0923c6d). Most syntax errors arise from improper ordering of these lexical tokens.

For example, if you forget to add the enclosing parenthesis when declaring a procedure, that is a syntax error:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/08/image-19.png)

Oops, I forgot the enclosing parenthesis. This should have been `Sub Foo()`.

In VBA, syntax errors are shown in red text by default. You can change this setting by going to Tools > Options > \_| Editor Format |\_

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/08/image-20.png)

You can make the Syntax Error Text any color you want. Red's probably a strong choice, though.

[Syntax errors are the easiest bugs to fix](https://nolongerset.com/some-bugs-are-better-than-others/) because they are so hard to miss. In fact, by default, VBA throws up a message box any time you move your cursor off of a line that contains a syntax error.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/08/image-18.png)

I get it. I made a mistake. The text is red. The message box is a bit much, to be honest.

I find this default behavior quite obnoxious. It's one of the first options I change on a new installation of VBA. To disable the behavior, go to Tools > Options and then uncheck the box next to **Auto Syntax Check*.* 

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/08/image-21.png)

While we're here, we might as well make sure that "Require Variable Declaration" is checked, too.

## Causes of Syntax Errors

There are two main causes of syntax errors in programming:

1. Learning a new language
2. Typos

#### Learning a new language

Every programming language has its own syntactical quirks. The C family loves braces. Python loves indentation. BASIC loves words. And Perl loves [#%@!{}\]&](https://everything2.com/title/RSA+in+3+lines+of+perl).

Every language comes with a learning curve. The leading edge of that curve is understanding the syntax. I find it takes me about two weeks of working in a language every day to become completely comfortable with the syntax.

During this two-week learning period, leaving the **Auto Syntax Check** option enabled might make sense. Once you become fluent in VBA, though, you'll want to turn that option off before you throw your computer through the window\*.

 *\* Yes, I said "through" the window, not "out" the window. I find the Auto Syntax Check so obnoxious that–if forced to use it–I would not even take the time to open the window prior to the defenestration. I would hurl my device with such force that it would shatter the glass into a million pieces. The gentle tinkling of the shards as they tumbled to the ground would soothe my savage state.*

*I may have an irrational hatred of the Auto Syntax Check feature.*

#### Typos

After the first two weeks of writing code–in any language–the main source of syntax errors will be typos: accidentally hitting Enter before adding a closing parenthesis; using a single-quote in place of a double-quote because your right pinky got to the quote key before your left pinky could hold down the Shift key; bumping the keyboard with your face as you reach down to pull bits of broken glass from between your toes (it was still worth it); etc.

## Consequences of Syntax Errors

Annoyance. That's pretty much it. 

It's close to impossible for a syntax error to slip through the cracks and end up in your production code, especially if you are explicitly compiling your code on a regular basis (Debug > Compile *or* \[Alt\] + \[D\], \[L\]).

---

### External references

[Parsing - Wikipedia![](https://en.wikipedia.org/static/apple-touch/wikipedia.png)Wikimedia Foundation, Inc.Contributors to Wikimedia projects![](https://upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png)](https://en.wikipedia.org/wiki/Parsing)

[\[MS-VBAL\]: Lexical TokensThe syntax of VBA programs is most easily described in terms of lexical tokens rather than individual Unicode characters. In particular, theMicrosoft Docsopenspecs-office![](https://docs.microsoft.com/en-us/media/logos/logo-ms-social.png)](https://docs.microsoft.com/en-us/openspecs/microsoft%5Fgeneral%5Fpurpose%5Fprogramming%5Flanguages/ms-vbal/848bd0b2-e453-4f50-a42a-452eb0923c6d)

[RSA in 3 lines of perl - Everything2.comCommon .signature file for people who oppose the idiotic restrictions on cryptography imposed by the United States government. The magic script is unrea...![](https://everything2.com/favicon.ico)Everything2.comCid Highwind](https://everything2.com/title/RSA+in+3+lines+of+perl)

### Referenced articles

[Some Bugs are Better than OthersNot all bugs are created equal. Avoid the expensive ones by making more of the ones that are easy to find and fix.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/03/car-2122580_1920.jpg)](https://nolongerset.com/some-bugs-are-better-than-others/)

*Image by [Vladan Rajkovic](https://pixabay.com/users/kampfmonchichi-11183378/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4868785) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4868785)*