Import XML file stopped working after moving to Excel 2007

djanu

Board Regular
Joined
Oct 30, 2006
Messages
55
Hi,

My Excel worksheet to import xml file was working in Excel 2003, but when I moved to Excel 2007 I started getting this exception:

Run-time error '9':
Subscript out of range

This is what I'm using:

======
Private Sub btn_importPROD_Click()

'1. UNZIP - This part will unzip .ear file to temp folder

Dim PathWinZip As String, FolderName As String
Dim ShellStr As String, strDate As String, Path As String
Dim FileNameZip As Variant, FSO As Object
PathWinZip = "C:\program files\winzip\"
If Dir(PathWinZip & "winzip32.exe") = "" Then
MsgBox "Please find your copy of winzip32.exe and try again"
Exit Sub
End If
FolderName = "C:\TempZip\"
FileNameZip = Application.GetOpenFilename(fileFilter:="Zip Files, *.ear")
If FileNameZip = False Then
Else
ShellStr = PathWinZip & "Winzip32 -min -e" _
& " " & Chr(34) & FileNameZip & Chr(34) _
& " " & Chr(34) & FolderName & Chr(34)
ShellAndWait ShellStr, vbHide
End If

'2. IMPORT XML - This part will import .xml file to Excel

With Sheets("Temp").Range("A1").CurrentRegion
ActiveWorkbook.XmlImport URL:="C:\TempZip\ABC.xml", ImportMap:=Nothing, _
Overwrite:=True, Destination:=Sheets("Temp").Range("A1")
Sheets("Temp").ListObjects("List1").Unlist
End With
======


When I get error and click on Debug it points to this:

Sheets("Temp").ListObjects("List1").Unlist

Any ideas why this worked fine in Excel 2003 and does not work in Excel 2007?
Any suggestions how to fix the issue?

Thank you,
djanu
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Watch MrExcel Video

Forum statistics

Threads
1,109,359
Messages
5,528,226
Members
409,809
Latest member
VICKRAM

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top