Dark Mode in VBA
VBA may not have a preset "Dark Mode" like other modern development environments, but it's not hard to create one yourself.
Longtime reader and commenter, Huy Truong, writes in with the following question (shared with permission):
[C]ould you please write an article on how to customize the VBA environment as Dark Mode? A few developers in my team complain that the white background hurts the eyes and they wonder if they can customize the VBA environment like VS code.
Great question, Huy!
There is no Dark Mode Setting, but...
Unlike many modern development environments, VBA does not have a simple Light Mode/Dark Mode setting.
However, you can create your own dark mode settings by changing the "Code Colors" in the Editor Format tab of the Options window. This won't affect the background color of Project Explorer, the Object Browser, or most of the other tool panes. It will change the colors in the Immediate Window and the main code window. In most setups, that accounts for the majority of the screen real estate.
To make these changes, go to Tools > Options... > Editor Format.
You'll need to click on each type of text in the "Code Colors" list box one at a time to make the changes to the Foreground, Background, and Indicator colors.
Note that the Font and Font Size are universal. For example, you can't show your Normal Text in one font and your Comment Text in another.
My Current Dark Mode Settings
If you're not sure where to get started, feel free to recreate my development environment using the settings below.
A few notes about my settings:
- The back color is black instead of the default white
- The color scheme has high contrast
- Comments appear in gray to make them feel like they're in the background
- Identifier Text appears in a different color than Normal Text
Cover image created with Microsoft Designer