Revitalise colours in the VB editor

Gustav BrockMVP
CERTIFIED EXPERT
Published:
The colour setting for coding in the VB editor (VBE) of Microsoft Office is a left-over from a past century. Here is how - with a few steps - to bring new life to the ancient editor.

Old and new colour themes

If you, like me, love the widely used dark themes of Windows and Visual Studio, working with the VB code editor of Microsoft Office - the VBE - is a daunting task. The few built-in options for adjusting the colours are too limited, thus of little help.

It could be one of the things you may accept to live with, but help is at hand. You'll have to download a small tool and to adjust a few things in the Registry but - being a coder - it shouldn't stop you.

The VBE Theme Editor

This is a tool created by Guillaume Allaux that can be found at GitHub:

VBEThemeColorEditor

Its purpose is to patch the VBE file - or to "inject" an alternative colour setting, if you like.

Unfortunately, the documentation is sparse and diverse, linking to old stuff and not easy to get a hold of. This is the reason for this article where the steps are lined up for anyone to follow.

Implementation

The first task is, of course, to download the tool from the link above. It is contained in a zip-file which also includes a subfolder with a couple of sample colour themes to apply.

Having unzipped the files, you are ready to proceed following these steps:

First, close all Microsoft Office applications.
Then, open VBEThemeColorEditor.exe using an administrator account:


You'll notice the brutal colours dating back to Windows 3.0.

To proceed, go to menu Theme, Load and browse to the subfolder Themes, which holds the sample themes, and select/open one of these. The one used here is VS2012 Dark.xml
At the bottom, VBE Theme Editor will display the theme name:


Notice the colour changes.

Then, click the button Apply theme to VBE.DLL to apply the theme. It will ask for the folder holding VBE7.DLL, often found here:

C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\VBA\VBA7.1

When located, select and open VBE7.DLL.
When done, close VBE Theme Editor.

Now, open the Registry editor, RegEdit.exe, and navigate to:  

HKEY_CURRENT_USER\Software\Microsoft\VBA\7.1\Common

Here, adjust these two keys to have these values (you can copy-paste the values as shown):

CodeBackColors:   2 7 1 13 15 2 2 2 11 9 0 0 0 0 0 0
CodeForeColors:   13 5 12 1 6 15 8 5 1 1 0 0 0 0 0 0

Confirm the saved values:


Finally, close RegEdit.

That's it. When you open, say, Access or Excel and then open the VBE, it should appear like this:


Custom colours

Your colour preferences may differ from this 2012-dated dark theme. Luckily, the colour settings are held in a simple xml file small enough to be opened in Notepad. For example, the replica of the Visual Studio 2012 Dark Themewe have used here, lists like this:

<?xml version="1.0" encoding="UTF-8"?>
<!--//
Description: A replica of the Visual Studio 2012 "Dark" theme colors in the VBE Editor
//-->
<VbeTheme name="VS2012" desc="VS2012 Dark Theme">
   <ThemeColors>
      <Color colorID="1" HexColor="000000" />
      <Color colorID="2" HexColor="1E1E1E" />
      <Color colorID="3" HexColor="343A40" />
      <Color colorID="4" HexColor="3C4248" />
      <Color colorID="5" HexColor="D4D4D4" />
      <Color colorID="6" HexColor="FFFFFF" />
      <Color colorID="7" HexColor="264F78" />
      <Color colorID="8" HexColor="569CD6" />
      <Color colorID="9" HexColor="74B0DF" />
      <Color colorID="10" HexColor="794E8B" />
      <Color colorID="11" HexColor="9F74B1" />
      <Color colorID="12" HexColor="E51400" />
      <Color colorID="13" HexColor="D69D85" />
      <Color colorID="14" HexColor="CE9178" />
      <Color colorID="15" HexColor="608B4E" />
      <Color colorID="16" HexColor="B5CEA8" />
   </ThemeColors>
</VbeTheme>

As you can see, the colours are specified in well-known hex codes and are easy to adjust.

Drawback

You will now be all set, you may believe, but that is not so. As we patch a file (VBE7.DLL) for this to work, the patches will vanish if this file gets updated by an Office update - and it will be updated, perhaps not often, but now and then. However, should this happen, all you need to do is to rerun the procedures described above.

Conclusion

With a few steps, easy to carry out for a programmer, it has been shown how to trim the colour setup of the ancient VB editor (dating back to the first VBE of Microsoft Office 95) to modern standards bringing relief to fans of the dark themes of Windows and Microsoft 365 or, with a few adjustments, to other colour preferences.

Download

The steps to carry out the above are listed here as a quick guide (save using the download tool):

Guide.txt

I hope you found this article useful. You are encouraged to ask questions, report any bugs or make any other comments about it below.
Note: If you need further "Support" about this topic, please consider using the   Ask a Question  feature of Experts Exchange. I monitor questions asked and would be pleased to provide any additional support required in questions asked in this manner, along with other EE experts.

Please do not forget to press the "Thumbs Up" button if you think this article was helpful and valuable for EE members.   

0
1,705 Views
Gustav BrockMVP
CERTIFIED EXPERT

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.