Hello All,
I am using the below code to read multiple xml files into a single excel worksheet.
I am looking to do below 2 amends:
- Display only the tag names instead of full path as column names.
- If one of the xml files has additional tags which contain data, the excel data gets jumbled. I want to align the columns of excel and display blanks in columns if tags are not present. For egs, in attachment, I want to align D7-D11 in Column E.
My Code:
Do While xFile <> ""
Set xmlWb = Workbooks.OpenXML(folderPath & "\" & xFile)
xmlWb.Sheets(1).UsedRange.Copy xlSWb.Sheets(2).Cells(xCount, 1)
Application.DisplayAlerts = False
xmlWb.Saved = True
xmlWb.Close False
Application.DisplayAlerts = True
xCount = xlSWb.Sheets(2).UsedRange.Rows.Count + 1
xFile = Dir()
Loop