LoginSignup
4
1

More than 5 years have passed since last update.

Windows標準ツールのcertutilを使ってVBEの色を変えてみる

Last updated at Posted at 2018-12-24

Screen Shot 2018-12-24 at 12.46.36.png

(2019/04/14 追記)
簡単な適用手順書を書きました
https://github.com/callmekohei/VBEColorsPlus

Summary

Windows標準ツールのcertutilを使ってVBEの色を変えてみる

Motivation

ネットでダウンロードしてとかではなく
できれば標準ツールでやってみたい

こんな感じ

Before

Screen Shot 2018-12-24 at 12.38.57.png

After

Screen Shot 2018-12-24 at 12.46.36.png

やりかた

01 VBE7.DLLをすこしいじる

// このあたりにあるはず・・・
C:\Program Files (x86)\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA7.1

VBE7.DLLのバックアップをとる!

VBE7.DLL
VBE7.DLL.20181218.BAK

gitbash上でやってみました!(TODO:cmdでもいつかやる)

function vs2012theme () {

  local fstSequence='ffffff00c0c0c0008080800000000000ff00000080000000ffff00008080000000ff00000080000000ffff00008080000000ff0000008000ff00ff0080008000'
  local sndSequence='00000000000080000080000000808000800000008000800080800000c0c0c000808080000000ff0000ff000000ffff00ff000000ff00ff00ffff0000ffffff00'
  local vbe7Default='ffffff00c0c0c0008080800000000000ff00000080000000ffff00008080000000ff00000080000000ffff00008080000000ff0000008000ff00ff0080008000'
  local vs2012theme='000000001e1e1e00343a40003c424800d4d4d400ffffff00264f7800569cd60074b0df00794e8b009f74b100e5140000d69d8500ce917800608b4e00b5cea800'

  # VBE7.DLLをテキストにする
  # HEXRAW format is 12
  certutil -f -encodehex $1 tmp.txt 12

  # 該当部分の文字列を置き換える
  # fstSeqの部分は1箇所、sndSeqの部分は39箇所ある
  # sndSeqは最初の部分のみ置き換える(sedは最初ののみ置き換えるので大丈夫)
  # see: Man sed ---> Sed Functions
  cat tmp.txt \
    | sed -e 's/'$fstSequence'/'$vs2012theme'/' \
          -e 's/'$sndSequence'/'$vs2012theme'/'\
    > tmp2.txt

  # テキストをバイナリにする
  certutil -f -decodehex tmp2.txt VBE7.DLL 12

  rm tmp.txt
  rm tmp2.txt

}

vs2012theme $1
$ bash foo.bash VBE7.DLL

02 色設定ファイルを調整する

regeditを立ち上げる

コンピューター\HKEY_CURRENT_USER\Software\Microsoft\VBA\7.1\Common

// 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

codebackcolors2.png

codeforecolors2.png

弱点

オプションで色を変えられない・・・(リストに出てくる色の候補が初期設定のまま・・・)

aaa.png

その他

もっと楽な方法

VBEThemeColorEditorを使う
https://github.com/gallaux/VBEThemeColorEditor

See

VBEThemeColorEditor
VBECustomColors
Eiji James Yoshidaの記録

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1