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.

VBE 화면 구성
VBE screen configuration

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.

Notepad++ 다크 모드(Dark Theme)
Notepad++ Dark Theme
VS Code 다크 모드(Dark Theme)
VS Code Dark Theme
PyCharm 다크 모드(Dark Theme)
PyCharm Dark Theme
DBeaver 다크 모드(Dark Theme)
DBeaver Dark Theme

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.

VBEThemeColorEditor.zip 파일 내용(1/2)
VBEThemeColorEditor.zip file contents (1/2)
VBEThemeColorEditor.zip 파일 내용(2/2)
VBEThemeColorEditor.zip file contents (2 of 2)

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”.

"Windows의 PC 보호" 창이 나오는 경우 "추가 정보" 클릭
If the “Windows protects your PC” window appears, click “More Info”

▼ Click Run button

실행 버튼 클릭
click the run button

▼ The first screen is as follows.

VBE Theme Editor 첫 화면
VBE Theme Editor first screen

▼ Run the Theme > Load menu.

Theme > Load 메뉴 실행
Run Theme > Load menu

▼ Select the “VS2012 Dark.xml” file in the Themes folder under the VBEThemeColorEditor.zip folder and click the “Open” button.

theme(테마) 파일 선택
Select a theme file

* 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.

Apply theme to VBE.DLL 버튼 클릭
Click Apply theme to VBE.DLL button

▼ Select the VBEx.DLL file and click the Open button.

VBEx.DLL 파일 선택
Select the VBEx.DLL file

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.

VBE7.DLL.BAK 파일 생성됨
VBE7.DLL.BAK file created

▼ When “Theme successfully applied” is displayed at the bottom, the tool is terminated.

Theme successfully applied
Theme successfully applied

4. Edit Registry

⊞ Win  + R Press the key to run regedit (registry editor).

레지스트리 편집기 실행
Run 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.

레지스트리 변경후
after registry change

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.

다크 모드(Dark Theme) 적용된 VBE
VBE with Dark Theme applied

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.

Windows Update 이후에 이상하게 변한 VBE 색상
VBE colors 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.

VBEx.DLL 패치를 다시 실행하여 정상적으로 다크 모드(Dark Theme) 적용된 VBE
VBE with dark mode applied normally by re-running the VBEx.DLL patch

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 ^_^

12 Responses

  1. Avatar photo 흐흐 says:

    Run the excel vba editor and change the theme.
    You can see the registry to be modified.
    Please note.

    • Avatar photo Zerom says:

      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

  2. Avatar photo 진저브래드맨 says:

    How can I change the font?!

  3. Avatar photo 진저브레드맨 says:

    What should I do if I want to change the font to d2coding?

    • Avatar photo Zerom says:

      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

      • Avatar photo 진저브레드맨 says:

        When I go to the editor window and try to edit the font, Excel crashes.

        • Avatar photo Zerom says:

          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.

        • Avatar photo 김앙꼬 says:

          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.

          • Avatar photo Zerom says:

            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

  4. Avatar photo juni says:

    VBE7.DLL
    It wasn't created...
    I am unable to proceed from this stage.
    It's Excel 2016 version, but there's no 'black';;

    • Avatar photo Zerom says:

      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

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish