VBA:没有换行的Debug.Print?

arm*_*rhb 10 debugging vba newline

对于在VBA中进行调试,Debug.Print我的代码中有几个语句.对于行解析块,我想打印该行,并输出与该行内联的任何标志,而在多个Debug.Print sFlag & sLineif/elseif/else块中没有多个语句.

在VBA中,有没有办法在Debug.Print语句结束时压缩换行符?

arm*_*rhb 16

事实证明,只需在Debug.Print语句末尾添加分号即可轻松完成此操作.像这样:

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
Run Code Online (Sandbox Code Playgroud)

因此,一些示例输出将是:

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!
Run Code Online (Sandbox Code Playgroud)