Step 1. Open VBScript Editor
Step 2. Program Code
Step 3. Required Variable Declaration
Step 4. Create Scripting FileSystemObject
Step 5. Create Excel Application Object
Step 6. Get the AbsolutePathName()
Step 7. Create the Xml file
Step 8. Write Data into the Xml File
Step 9. Open Excel File
Step 10. Define Sheet object
Step 11. Loop to get all used row data
Step 12. Release created objects
Step 13. Save Created Script and Run
Step 14. Sample Excel file data
Step 15. Congratulation 🙂
1.Open VBScript Editor
Open the VB Script editor either from desktop VBS shortcut or from start menu.
Here you see the Program for “How to Create Xml file from Excel using vbs”.
In next slides we will discuss whole code line by line for better understanding.
3.Required Variable Declaration
Here we Declare the Required variables.
We use this variable as global variable and use when we declare required object.
4.Create Scripting FileSystemObject
We create the Scripting FileSystemObject because we will create the Xml file in the system, so for this we need the path and to get path we this object.
5.Create Excel Application Object
Here we create Excel Application object. we need this object to open our excel file for read the data for xml.
6.Get the AbsolutePathName()
Here we set the actual path of script into the work_path variable by using the GetAbsolutePathName() method. This method returns the actual folder path where our script exist in the system.
7.Create the Xml file
We create the required Xml file on the specified path return by above method.
8.Write Data into the Xml File
9.Open Excel File
Using Created Excel object we open the excel file from the specified path.
10.Define Sheet object
Using open excel file object we can get whole workbook data.
11.Loop to get all used row data
Here we loop to extract all used rows data of specified sheet.
12.Release created objects
After completion of Xml file creation we need to close the opened excel file and also release the created objects.
13.Save Created Script and Run
14.Sample Excel file data
Here you see the sample Excel file data by which we want to create the required Xml file.
Congratulation ! We have successfully Write our VBscript program “To create the Xml file from Excel data using VBScript“.