Is there any way to save an Excel table as XML? I have the XML Schema file... and some data in a table... and I have in Excel the Save as XML file option but can I save a file as XML from VBA? I want to automate a process and I didn;t find nothing on this option. Thanks!
VBA code to Convert and Save the Excel to XML- Instructions Step 1: Open a New Excel workbook. Step 2: Press Alt+F11 – This will open the VBA Editor (alternatively, you can open it from Developer Tab in Excel Ribbon) Step 3: Insert a code module from then insert menu of the VBE.
Excel VBA XML. The full form of XML is eXtensible Markup Language which is much like an HTML file, is designed to store and transport the data from different programs. XML file stores the data which includes the splits and separators. We can create a VBA code by which we can import the data from the XML file into Excel ...
Click File > Save As, and select the location where you want to save the file. , point to the arrow next to Save As, and then click Other Formats. In the File name box, type a name for the XML data file. In the Save as type list, click XML Data, and click Save.
the good ol' macro recorder saved me this time :)) (Why didn't I used it before I posted here?) So... To load an xml schema you have:
ActiveWorkbook.XmlMaps.Add("Book2.xml", "raport").Name _
= "raport_Map"
And to save it as xml:
ActiveWorkbook.SaveAsXMLData Filename:="Book3.xml", _
Map:=ActiveWorkbook.XmlMaps("raport_Map")
Who would have thought that it's that easy?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With