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
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,113
Messages
5,835,456
Members
430,357
Latest member
Greshapa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top