VBA:没有换行符的Debug.Print吗? [英] VBA: Debug.Print without newline?
问题描述
对于在VBA中进行调试,我在整个代码中都有几个Debug.Print
语句.对于行解析块,我想打印该行,并输出与该行 inline 的所有标志,而在许多if/elseif/else块中没有多个Debug.Print sFlag & sLine
语句.
For debugging in VBA, I have several Debug.Print
statements throughout my code. For a line-parsing block, I'd like to print the line, and output any flags inline with the line, without having multiple Debug.Print sFlag & sLine
statements throughout the many if/elseif/else blocks.
在VBA中,有没有一种方法可以在Debug.Print
语句末尾取消换行符?
Is there a way, within VBA, to suppress the newline at the end of a Debug.Print
statement?
推荐答案
事实证明,只需在Debug.Print
语句的末尾添加分号即可轻松实现此目的.像这样:
It turns out you can easily do this by simply adding a semicolon to the end of your Debug.Print
statement. Like so:
While oExec.StdOut.AtEndOfStream = False
sLine = oExec.StdOut.ReadLine
If bInFileSystem Then
If AnalyzeFileSystemLine(sLine) = False Then
Debug.Print "[FSERR]: ";
End If
ElseIf bInWASCheck Then
If AnalyzeWASLine(sLine) = False Then
Debug.Print "[WASERR]: ";
End If
End If
Debug.Print sLine
Wend
因此,一些示例输出将是:
So, some sample output will be:
test text things look good!
[FSERR]: uh oh this file system is at 90% capacity!
some more good looking text :)
[WASERR]: oh no an app server is down!
这篇关于VBA:没有换行符的Debug.Print吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!