When using the BOMs to XML Example (VBA)

When using the Export BOM to XML as shown in Export BOMs to XML Example (VBA) I have two questions.

     First how can I write each cell of the table after the previous cell with no spaces or carriage returns. I was able to take the generated file and edit it in notepad to massage the format to get it to import in our SAP. I had to remove all spaces and carriage returns essentially creating a single line file.

currently the example has me using,

  For j = nStart To 18

        XMLfile.WriteLine "                "

        For k = 0 To nNumCol - 1

            XMLfile.WriteLine "                    " + "<" + sHeaderText(k) + ">" + swTableAnn.Text2(j, k, True) + ""

        Next k

        XMLfile.WriteLine "                "

    Next j

So each row becomes a line and I am not sure how I can do this otherwise.

     Second how do you suggest i add an XML declaration to the file? currently I'm using 'XMLfile.WriteLine "" but this will work for the import (Once I remove spaces and CR's) but it wont preview in MS Internet explorer as our current files from inventor do.

Thank you in advance

SolidworksApi/macros