1. Click on File and click on New Project.

2. Under Visual basic, Select Windows and then select Windows Form App (.NET Framework)

3. Give the project an appropriate name and select a location where you want to save this project.

4. Once done, click OK.

5. When the project opens you will be presented with Form1.

6. For the time being just let’s create 3 buttons and name then Create, Open and Cancel.

7. Give an appropriate heading to the form. Your form would look something like this.

8. Next we set references for Excel in our project. For this, click on the menu Project | Add Reference. You will be presented with an Add Reference dialog box. Navigate to the COM Tab and select the Microsoft Excel Object Library.

9. Double click on any of the button to open the Form1 Code Area and paste this line of code at the very top.

Imports Excel = Microsoft.Office.Interop.Excel

10. Double click on the Cancel button and paste this line of code.


This is how your code should look like.

And you are all set for automating Excel From VB.Net.