Reputation: 155
I want to write rows of data from Excel to an XML file. However, I need to validate the data before I commit to file. I know that WriteLine()
has its own end of line but I need to add it in the string. So I want to do something like this:
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)
...not this:
.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>")
...where {??} is the end of line character. I've seen Chr(10) & Chr(13)
mentioned as an option but nothing definitive.
Upvotes: 1
Views: 194
Reputation: 878
FSO is poorly documented about what it considers line breaks on reading and writing. But you will probably be safe putting out either a return-and-linefeed (vbCrLf) or a bare linefeed (vbLf). On Windows, the former is safest.
strXML = "<BOM>" & vbCrLf _
& "<BOM_NBR>" & p_typBomValues.strParentPNbr & "</BOM_NBR>" & vbCrLf _
& . . .
Upvotes: 1