VBA Debug.Print 记录到哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2916287/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 10:28:43  来源:igfitidea点击:

Where does VBA Debug.Print log to?

vbadebuggingms-office

提问by l--''''''---------''''''''''''

Where does Debug.Printoutput messages?

在哪里Debug.Print输出消息?

回答by Dirk Vollmar

Where do you want to see the output?

你想在哪里看到输出?

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

通过输出的消息Debug.Print将显示在即时窗口中,您可以按Ctrl+打开该窗口G

You can also Activatethe so called Immediate Windowby clicking View -> Immediate Window on the VBE toolbar

您还可以通过单击 VBE 工具栏上的“查看”->“立即窗口”来激活所谓的“立即窗口”

enter image description here

在此处输入图片说明

回答by LimaNightHawk

Debug.Printoutputs to the "Immediate" window.

Debug.Print输出到“立即”窗口。

Debug.Print outputs to the Immediate window

Debug.Print 输出到立即窗口

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:

此外,您可以简单地?在即时窗口中直接输入,然后输入一条语句(然后按 Enter),然后输出就会出现在下方,如下所示:

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

? myWidget.name

...to setthe property of an object...

...设置对象的属性...

myWidget.name = "thingy"

myWidget.name = "thingy"

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

...或者甚至在调试模式下执行函数或代码行:

Sheet1.MyFunction()

Sheet1.MyFunction()