AnsweredAssumed Answered

When using the BOMs to XML Example (VBA)

Question asked by Vince Riha on Nov 30, 2018
Latest reply on Dec 6, 2018 by Vince Riha

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 "                <BOMITEM>"

        For k = 0 To nNumCol - 1

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

        Next k

        XMLfile.WriteLine "                </BOMITEM>"

    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 "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "utf-16" & Chr(34) & "?>" 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