LoginSignup
2
2

More than 3 years have passed since last update.

VBE のイミディエイトをクリアする方法

Posted at

Excel VBA を利用している時によく利用するイミディエイト。
デバッグ時に、MsgBoxか、Debug.Printを使うと思います。

Debug.Printの出力結果を表示するイミディエイトウィンドウ。
実行の度にクリアする方法を探してみました。
しかし、見つからなかったため、独自の研究で発見した方法を書き残しておきたいと思います。

vbe.bas
Private Sub VBE_ImidiateClear()
    Call Excel.Application.SendKeys("^g^a^g{DEL}")
    Call Excel.Application.SendKeys("%(w1)")
    Stop
End Sub

基本は、VBEにショートカットキーを送信して削除です。
ミソは「Stop」命令に有りました。
実行の度に、一時停止するのでF5など必要ですが
毎回選択、クリアするよりは楽だと思います。

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