I need to create a macro that allows me to choose all .xml files and import them into excel. At this point the process is as follows: - I open the first one manually and then call the macro that imports all the others selected. I would like to know how I can do all these steps with just one macro.
Sub Import1()
Dim wb As Workbook
Dim instance As XPath
Dim Map As XmlMap
Dim XPath As String
ChDir "C:\rwindows"
With ActiveWorkbook.XmlMaps("evs_rpb_Mapa")
.ShowImportExportValidationErrors = False
.AdjustColumnWidth = True
.PreserveColumnFilter = True
.PreserveNumberFormatting = True
.AppendOnImport = True
End With
fileToOpen = Application _
.GetOpenFilename("XML Files (*.xml), *.xml", , "Import XML", , True)
Application.DisplayAlerts = False
If IsArray(fileToOpen) Then
For Each fil In fileToOpen
ActiveWorkbook.XmlMaps("evs_rpb_Mapa").Import URL:=fil
Next fil
Else
Exit Sub
End If
Application.DisplayAlerts = True
End Sub
My knowledge is none. If anyone can help thank you. Thank you.