0 Replies - 1370 Views - Last Post: 25 August 2012 - 10:53 AM Rate Topic: -----

#1 Manukrrish  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 24-August 12

Import XML Data to Excel using Excel Macros

Posted 25 August 2012 - 10:53 AM

Hi I am working on some stuff where i need to Import the data present in XML file to excel sheet.
i wrote below code for it

Sub ImportXMLtoList()
Dim strTargetFile As String
Application.DisplayAlerts = False
strTargetFile = "C:\BookData.xml"
Workbooks.OpenXML Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList
Application.DisplayAlerts = True
End Sub

I want to do it in Excel 2003 using Macros. When i run the same above code in MS2007 it imports data succesfully,but it opens an new excel file and paste the data in Row order.
But when i run the same code in MS2003 a pop saying "The specified XML Source Doesnt refer to a schema.Excel will create schema based on the XML source data" is displayed, when i click ok button then Nothing is pasted in Excel.

I can say XML contains Repeating and Non-Repeating Elements.Is there any way to import the required elements data instead of all data present in XMl.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1