Summary
Excel for Mac と Excel for Win on VMWare で VBA を書くための環境設定
Conclusion
VBAコードをMacOSX
とWin
で共用するのは無理かも・・・
VBA は Excel for Win 一択
Mac, Winで使うなら Python を使うことを考えてみる
callmekohei's 心折れたポイント
Excel for Mac で・・・・
ADO, FSO etc.の扱いが難しい(というか僕にはむり〜)
VBEで日本語が入力、出力できない
32bit and 64bit の問題も多分出てくると思う・・・
Environment
( MacOSX )
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G65
( VMWare )
Menu bar > VMWare Fusion > About VMWare Fusion
VMWare Fusion 8.5.10
( Microsoft Excel for Mac )
Menu bar > Excel > About Microsoft Excel
Microsoft Excel for Mac
Version 16.16.2
Excel for Mac の bit の確認方法
$ pwd
/Applications/Microsoft Excel.app/Contents/MacOS
$ file Microsoft\ Excel
Microsoft Excel: Mach-O 64-bit executable x86_64
( Microsoft Excel )
ファイル > アカウント > エクセルのバージョン情報
Microsoft Excel 2013
Version 15.0.5067.1000 32bit
Prepare
input source
input source
の切り替えショートカットを Shift Space
にする
reason : VBEでの単語補完が Ctrl Space なのでかぶらないようにする
how : AppleSymbolicHotKeys plist dict
を変更する
# 下記コマンドをターミナルで実行して再起動
$ defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 60 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>32</integer><integer>49</integer><integer>131072</integer></array><key>type</key><string>standard</string></dict></dict>"
see also :
OS X で Shift+Space で入力ソースを切り替える方法
システム環境設定をターミナル(defaultsコマンド)から設定する方法(Mission Control)
勝手に独り読書会 - その08 (さいご)
what do the parameter values in AppleSymbolicHotKeys plist dict represent?
control-command-Dの設定はどこへ行った?Add Star
Function key
Function key( F5, F11 etc.. ) をダイレクトに使えるようにする
reason : Debug run ( F5 ), launch VBE ( F11 ) を使えるようにするため
how : System preferences を変更する
Menu bar > apple mark > System preferences > Keyboard > Keyboard
Use F1,F2, etc key... にチェックをつける
Install
VMWare Fusion
VMWare
Windows10( install on VMWare )
Windows10
ライセンスが必要?
callmekohei は昔購入した win8 pro のライセンスキーを入力しました
Font ( install on Win , Win's VBEで使うため(個人的好み))
Mig2M
Excel ( for win and mac )
Microsoft Store
sign in > account > order history > Manage subscriptions > Install
Setting of VMWare
install VMWare Tools
// Windows10 を立ち上げた状態で
01. Virtual Machine > Install VMWare Tools
02. デスクトップ上にでてきたボタン?を押して exe を実行する
File sharing
// Windows10 を立ち上げた状態で
menu bar > Virtual Machine > Setting > Sharing
on : Enable Shared Folders
Mirrored Folders( Desktop, Documents, Downloads )
Key mappings
OSXのショートカットをWindowsで効かせないようにする
Windowsで Cmd Q
を押した時に VMWare
が終了しないようにする
// Windows10 を立ち上げた状態で
menu bar > Virtual Machine > Setting > Keyboard and Mouse
add Profile file ( press + button )
Mac Host Shortcuts
Off : Enable Mac OS Host Keyboard Shortcuts
Fusion Shortcuts
Off : Quit
Setting of Win
MS-IME
の切り替えを Shift Space
にする
reason : OSXと同じにする
how : MS-IME
でキーボードショートカットを設定
編集操作 > キー設定 > 変更
キー : Shift+Space
入力/変換 : IMEオン/オフ
see also: ストレス解消! MacとVMware Fusionで日本語入力キーを同じにする方法
Setting of VBE
VBE
の設定はお好みで・・・
Excel for Mac
Alt F11
Menu bar > Excel > preferences
Excel for win
Alt F11
ツール > オプション
callmekohei's recommend
( excel for mac )
Off : Editor > code setting > Auto Syntax check
On : Editor > code setting > Require Variable Declaration
( excel for win )
off : 編集 > コードの設定 > 自動構文チェック
on : 編集 > コードの設定 > 変数の宣言を強制する
callmekohei's font
( excel for mac )
consolas
( excel for win )
Mig2M
see also:
【エクセルVBA】最初っから知っておきたいVBEのショートカットキーまとめ
【エクセルVBA】VBEにコメントブロックのショートカットキーを設定する方法
課題
Excel for Win の VBEのフォントをconsolas
設定して日本語を表示させたい!
Windows10でフォントリンクがうまく働かない
callmekohei がやったこと
// 1. レジストリエディターで SystemLink をひらく
コンピューター\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink
// 2. Conslas ファイルを作成
MEIRYO.TTC,Meiryo,128,96
を記入
// 3. 再起動
結果