Creating a Dark Theme in VBE (VB Editor)
VBE (VB Editor), an editor for coding Excel VBA, does not have a function to set to dark mode among the functions provided.
Excel VBA Course (5): Excel file extension, VBE, font setting#2.7.4._VBE_screen_configuration mentioned the following screen.
As you can see in the image above, the VBE main screen is displayed in black text on a white background.
I prefer the Dark Theme, which displays light-colored text on a dark-colored background. Notepad++, VS Code, DBeaver, Pycharm, etc. are all used in dark mode.
In the meantime, I haven't been able to find a way to set VBE (VB Editor) to dark mode, but I recently found out and I'm sharing the method.
Follow the steps below in order.
VBE Dark Theme setting sequence
1. Quit all MS Office applications
Close all MS Office applications (Excel, Word, PowerPoint, etc.).
If you do not exit, the VBEx.DLL file may not be patched during the process below, so be sure to quit and proceed with the next process.
2. Download the tool
Download the VBEThemeColorEditor.zip file from the path below.
https://github.com/gallaux/VBEThemeColorEditor
Click the link below to get it directly.
https://github.com/gallaux/VBEThemeColorEditor/raw/master/VBEThemeColorEditor.zip
The contents of the downloaded file are as follows.
Unzip the above compressed file to a suitable location.
3. Patch VBEx.DLL by running the tool
Execute the VBEThemeColorEditor.exe file.
▼ If the “Windows protects your PC” window appears as follows, click “More information”.
▼ Click Run button
▼ The first screen is as follows.
▼ Run the Theme > Load menu.
▼ Select the “VS2012 Dark.xml” file in the Themes folder under the VBEThemeColorEditor.zip folder and click the “Open” button.
* Note: The contents of the VS2012 Dark.xml file are as follows.
<?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>
If you look at the contents, you can see that hexadecimal RGB color is specified for HexColor of colorID 1 ~ 16. If you have a color you want, you can copy this file, edit it, and apply it.
▼ The color displayed on the screen changes as follows. Click the “Apply theme to VBE.DLL” button.
▼ Select the VBEx.DLL file and click the Open button.
The path and file name are different depending on the version and type of Microsoft Office. Select the file referring to the information below.
▣ Microsoft Office 64bit
▶ MS 365
– Path: C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\VBA\VBA7.1
– File name: VBA7.DLL▶ Version 2007 or higher (2007, 2010, etc.)
– Path: C:\Program Files\Common Files\microsoft shared\VBA\VBA7.1
– File name: VBA7.DLL▶ Version below 2007 (2003, XP, etc.): (Can't check because there is no corresponding version)
– Path: C:\Program Files\Common Files\microsoft shared\VBA\VBA6.x
– File name: VBA6.DLL▣ Microsoft Office 32bit
▶ MS 365
– Path: C:\Program Files (x86)\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA7.1
– File name: VBA7.DLL▶ Version 2007 or higher (2007, 2010, etc.)
– Path: C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA7.1
– File name: VBA7.DLL▶ Version 2007 or less (2003, XP, etc.): (Unable to check because there is no corresponding version)
– Path: C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6.x
– File name: VBA6.DLL
▼ A backup file (VBE7.DLL.BAK) is automatically created in that folder.
▼ When “Theme successfully applied” is displayed at the bottom, the tool is terminated.
4. Edit Registry
⊞ Win + R Press the key to run regedit (registry editor).
▼ In Registry Editor, move to the path below.
▶ Microsoft Office version 2007 or later
– Path: HKEY_CURRENT_USER\Software\Microsoft\VBA\7.1\Common▶ Microsoft Office version less than 2007 (2003, XP, etc.)
– Path: HKEY_CURRENT_USER\Software\Microsoft\VBA\6.x\Common
* Precautions (2023-02-07, “Hehe” comments added)
If the folder or value in the above path is not visible in the Registry Editor, try again after running Excel VBA Editor at least once. (Shortcut ALT+F11 after running Excel)
▼ Among the values on the right, change the following two values.
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
▼ After the change, it is as follows.
5. Check VBE with Dark Theme applied
Shortcut keys to launch a Microsoft Office application (eg Excel) Alt + F11 If you click , you can check the VBE with Dark Theme applied as follows.
At this point, you are all set.
It's a pity that the project on the left side of the VBE screen, the properties window, and the watch window at the bottom are not applied, but even this is enough to make the eyes comfortable.
I hope it will be helpful to those who were disappointed with the dark mode like me.
▼ 2022-08-07 content added
There was a phenomenon that the VBE color changed strangely after Windows Update.
Among the above, “3. After running the tool and executing the VBEx.DLL patch, it returned to Dark Theme again.
It is probably caused by the change of previously patched DLL files during the Windows Update process. It's a bit annoying to have to re-patch every time you update Windows, but I can't give up on dark mode ^_^
Run the excel vba editor and change the theme.
You can see the registry to be modified.
Please note.
Hello, thanks for leaving a comment.
As you said, Excel VBA editor must be executed first to create related Registry values.
"4. Registry Editing” has been reflected in the table of contents.
thank you
How can I change the font?!
Please refer to the comments below.
What should I do if I want to change the font to d2coding?
the text below <엑셀 VBA 강좌(5) - 2.7.5. 가독성 좋은 고정폭 글꼴 추천> Please refer to the contents and make changes.
https://prodskill.com/ko/excel-vba-lecture-5-excel-file-extension-vbe-font/#275_readability_good_monospace_font_recommendation
When I go to the editor window and try to edit the font, Excel crashes.
Ah... when I try to edit the font in the VBA editor settings, Excel is forced to quit.
I'm not sure if setting it to dark mode will have any effect.
Changing the font is also possible in the Registry Editor.
1. Exit Excel
2. Run regedit.exe
3. Go to the path below
– Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\VBA\7.1\Common
4. Set the values below
– FontFace: Enter the font name (e.g. D2Coding)
– FontHeight: Select “Decimal” as the unit and enter the font size (e.g. 10)
5. Run Excel and check the VBA editor
Hope this helps.
The problem is with Excel, but there is no solution.
Recently, MS Office365 updates almost in real time, so it can be resolved even with patches 2-3 times a week.
There is a way to use a DLL patch, but you can also consider using a personal change from the 16 basic colors.
There are a lot of them on YouTube.
I also think that DLL patching is a bit of a hassle haha.
Let’s also learn how to change the color.
thanks for the comment
VBE7.DLL
It wasn't created...
I am unable to proceed from this stage.
It's Excel 2016 version, but there's no 'black';;
Check the VBE7.DLL file path.
– 64bit Excel: C:\Program Files\Common Files\microsoft shared\VBA\VBA7.1
– 32bit Excel: C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA7.1