+ Reply to Thread
Results 1 to 1 of 1

How do I import an XML file into Excel using Macros to ensure none of the data is truncate

  1. #1
    Registered User
    Join Date
    10-03-2013
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2010
    Posts
    2

    How do I import an XML file into Excel using Macros to ensure none of the data is truncate

    Hi,

    I am trying to import an XML file in Excel but the problem I face is that the numbers are getting truncated.

    For ex: 008 in XML is getting imported as 8
    and 73.33333333333333 is getting truncated as 73.33333

    I want data as is from XML to be in Excel. Any help is highly appreciated.

    I tried this macro: but the data is getting truncated.

    I picked this from another forum:'

    Sub ImportXMLtoList()
    Dim strTargetFile As String
    Dim wb as Workbook

    Application.Screenupdating = False
    Application.DisplayAlerts = False
    strTargetFile = "C:\example.xml"
    Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
    Application.DisplayAlerts = True

    wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets("Sheet2").Range("A1")
    wb.Close False
    Application.Screenupdating = True


    End Sub



    Thanks
    Last edited by kiran_rangarajan; 03-20-2015 at 11:19 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Import data from Excel file into filtered cells in another Excel file
    By Rebecca12 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-14-2012, 04:05 PM
  2. File name without file path (data import) - Excel crash
    By exinx in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2012, 02:08 AM
  3. Import excel sheet data into Ms-access using VBA macros
    By gokul1242 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-29-2012, 07:13 AM
  4. I want Macros to delete exisitng sheets and import new data from a .csv file.
    By parinita_kothari in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2012, 06:26 AM
  5. Replies: 0
    Last Post: 08-10-2010, 07:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1