I had to upgrade my office suite to 2013 and found that a macro that was working in Excel 2010 is not working in Excel 2013. I have searched the forums for hours today but did not come across an answer for my macro.
It gets hung up on this line of code:
"Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)"
I am loading an xml file into sheet2, which has four deliberate spaces on either side of the name sheet2.
The display alerts work to suppress some pop up messages that I don't want to see.
Any help or guidance will be greatly appreciated.
I am on a Win 7 64 bit PC, with 16 gb of ram, running 32 bit Office Professional Plus 2013
It gets hung up on this line of code:
"Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)"
Code:
Sub ImportXMLtoSheet2()
Dim strTargetFile As String
Dim wb As Workbook
Application.DisplayAlerts = False
strTargetFile = "P:\report.xml"
Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets(" Sheet2 ").Range("A1")
Application.DisplayAlerts = False
wb.Close
End Sub
I am loading an xml file into sheet2, which has four deliberate spaces on either side of the name sheet2.
The display alerts work to suppress some pop up messages that I don't want to see.
Any help or guidance will be greatly appreciated.
I am on a Win 7 64 bit PC, with 16 gb of ram, running 32 bit Office Professional Plus 2013