![]() ![]() If you insist to use the previous VBA code with one loop, you could consider putting the second loop in another function and calling the function in the first loop for a workaround. , ImportMap:=Nothing, Overwrite:=True, Destination:=Range("D2") Sub ImportXMLData()ĪctiveWorkbook.XmlImport URL:="C:\Users\test\Documents\DataSourceXML.xml" _ VBA code, you have to edit your XML to be a standard one. To import the data into Excel as same as the result of your previous ![]() But I find your XML file doesn't following a standard XML format. You could resort to Workbook.XmlImport method to import an XML file into the workbook with VBA code below. You could clickĭata-> From Other Sources-> From XML Data Import to do that. In fact, there is an existing feature of Excel to import data from an XML file directly. Worksheets("Sheet1").Range("D2")(Col, Row).Value = xChild.nodeTypedValue Set NodeList = XDoc1.SelectNodes("//ResultSet") ![]() Can you suggest me some code which will take only one loop to insert them? Is it possible to have one loop over here? Right now am using the following VBA Code which contains two loops to insert the data into EXCEL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |