WriteLine行尾字符

我想从Excel写入数据行到一个XML文件。 但是,我需要在提交文件之前validation数据。 我知道WriteLine()有自己的行结束,但我需要将其添加到string中。 所以我想要做这样的事情:

 strXML = "<BOM>" & {??} _ & "<BOM_NBR>" & p_typBomValues.strParentPNbr & "</BOM_NBR>" & {??} _ & "<DESC>" & p_typBomValues.strParentDesc & "</DESC>" & {??} _ & "<ECO_NBR>" & p_typBomValues.strEcoNbr & "</ECO_NBR>" & {??} _ & "<REV>" & p_typBomValues.strRevision & "</REV>"" & {??} .WriteLine(strXML) 

…不是这个:

  .WriteLine ("<BOM>") .WriteLine ("<BOM_NBR>" & p_typBomValues.strParentPNbr & "</BOM_NBR>") .WriteLine ("<DESC>" & p_typBomValues.strParentDesc & "</DESC>") .WriteLine ("<ECO_NBR>" & p_typBomValues.strEcoNbr & "</ECO_NBR>") .WriteLine ("<REV>" & p_typBomValues.strRevision & "</REV>") 

…其中{??}是行字符的结尾。 我已经看到了Chr(10) & Chr(13)作为一个选项,但没有明确的说法。

FSO对于阅读和写作方面的断断续续的logging很less。 但是,你可能会安全地输出一个返回和换行符(vbCrLf)或一个纯粹的换行符(vbLf)。 在Windows上,前者是最安全的。

 strXML = "<BOM>" & vbCrLf _ & "<BOM_NBR>" & p_typBomValues.strParentPNbr & "</BOM_NBR>" & vbCrLf _ & . . .