2
I need to create a macro that allows me to choose all . xml files and import them into excel. At the moment the process is as follows: - I open the first one manually and then call the macro that imports all the other selected ones. I wanted to know how I can perform 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, I’d appreciate it. Thank you.
It’s been a while and I haven’t heard back. If anyone knows how I can get around this situation I’d appreciate it.
– Pedro Lima