Method 1 – Go to VBA Module
In this step, we will show how to get into the VBA module.
- Enter a blank Excel sheet.
- Go to the Sheet Name section at the bottom section.
- Press the right button of the mouse.
- Choose View Code from the appeared Context Menu.
- VBA window appears now.
- Click on the Insert tab.
- Choose the Module option from there.
- The VBA module window appears to write code.
Method 2 – Write VBA Code in the Module and Run
- Copy and paste the following VBA code on the module.
Sub Conversion()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim w_book As Workbook
With Workbooks.OpenXML("D:\OneDrive\Softeko\25-0180_5352\Salary_Sheet.xml" _
, , xlXmlLoadImportToList)
.SaveAs ("D:\OneDrive\Softeko\25-0180_5352\Salary_Sheet.xlsx")
.Close
End With
End Sub
- Press the F5 button to run the code.
Check the Converted File
We will check the newly created file after successfully implementing the VBA code.
- Open the folder from File Explorer.
We can see that the Excel file is saved here successfully.
- Open the Excel file.
Data were also extracted here properly.
Download Practice Workbook
You can download the following practice workbook to exercise while you are reading this article.
Related Articles
- Difference Between XML and Excel Files
- [Solved]: XML File Not Opening in Excel
- How to Convert Large XML to Excel
- How to Extract Data from XML File to Excel
- How to Convert XML to Excel Table
- How to Convert XML to Columns In Excel
- How to Edit XML File in Excel
<< Go Back to Import XML to Excel | Importing Data in Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!