Where does Debug.Print
output messages?
Asked
Active
Viewed 4.9e+01k times
327

Dirk Vollmar
- 172,527
- 53
- 255
- 316

Alex Gordon
- 57,446
- 287
- 670
- 1,062
-
[specific to the Visual Basic for Applications (VBA) Language Reference for Office](http://msdn.microsoft.com/en-us/library/gg278865(v=office.14).aspx) – Oct 23 '14 at 09:43
-
https://www.wallstreetmojo.com/vba-debug-print/ – GenDemo Apr 14 '21 at 01:56
2 Answers
408
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

Dirk Vollmar
- 172,527
- 53
- 255
- 316
-
10This is true if you are in an office application which supports VBA, but if you are using via WSH you may need to use MsgBox (*shudder*) or some similar technique as the immediate window is not available. – AJ. May 26 '10 at 20:09
107
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:
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()

LimaNightHawk
- 6,613
- 3
- 41
- 60