XML data from one Excel cell to new XML file [closed]

Posted on

QUESTION :

In A1, A2, A3… A16000 I have the entire context of a XML in one cell.

Example: The entire XML for one invoice is in A1, the next invoice in A2 and so on.

How could I save the context of each cell, into seperate XML files?

I tried to extract the relevant data directly from the cell using “filterxml”, but I ran into trouble when the inovice contained multiples item lines.

ANSWER :

Assuming the entire XML is indeed a valid XML format and you simply need to export each cell as it’s own file, you could use the following VBA:

Sub ExportCellsToXMLFiles()
On Error GoTo err:
Dim OutputFolder: OutputFolder = "D:TestXML" 'Specify a valid dir to output to - make sure you include the trailing slash.

Leave a Reply

Your email address will not be published. Required fields are marked *