Where does VBA Debug.Print log to?

2019-01-04 18:25发布

Where does Debug.Print output messages?

2条回答
啃猪蹄的小仙女
2楼-- · 2019-01-04 19:09

Where do you want to see the output?

Messages being output via Debug.Print will be displayed in the immediate window which you can open by pressing Ctrl+G.

You can also Activate the so called Immediate Window by clicking View -> Immediate Window on the VBE toolbar

enter image description here

查看更多
爷、活的狠高调
3楼-- · 2019-01-04 19:17

Debug.Print outputs to the "Immediate" window.

Debug.Print outputs to the Immediate window

Also, you can simply type ? and then a statement directly into the immediate window (and then press Enter) and have the output appear right below, like this:

simply type ? and then a statement directly into the immediate window

This can be very handy to quickly output the property of an object...

? myWidget.name

...to set the property of an object...

myWidget.name = "thingy"

...or to even execute a function or line of code, while in debugging mode:

Sheet1.MyFunction()

查看更多
登录 后发表回答