I am pretty new to VBA and importing data from a xml file. At the moment I am working on a VBA script which imports the values of specific xml nodes in to an excel sheet. I was using the following guide which i changed to my needs:
https://excel-macro.tutorialhorizon.com/vba-excel-read-data-from-xml-file/
But I have some trouble to import decimal numbers. In the xml file the decimal seperator is a comma which the script will not recognize. Excel turns 75,13 into 7513.
When I change the decimal seperator in the xml file to a dot it works but is there a way to do this without touching the xml file for pre-processing?
I import the nodes as follows:
mainWorkBook.Sheets("Sheet1").Range("A" & intCounter).Value = G_JAHRE(i).ChildNodes(0).nodeTypedValue
It is a bit tricky to give you a perfect solution with the limited input, but here's a start:
mainWorkBook.Sheets("Sheet1").Range("A" & intCounter).Value = Replace(G_JAHRE(i).ChildNodes(0).nodeTypedValue, ".", ",")
It makes a search for dot and replace with comma.
It is not an ideal solution and there are plenty of cases where it won't work, but if you have fairly clean input, it will most likely help.