I am trying to run a file I downloaded to import and export data from excel. I downloaded from from the following site:
http://www.sattsoft.com/sourcecodes/details/1/9/import-export-data-to-excel-using-vb-net.html
When I run the file the error comes on the following lines
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
These are the errors that come on those respective lines
Type "Microsoft.Office.Interop.Excel.Application is not defined"
Type "Microsoft.Office.Interop.Excel.Workbook is not defined"
Type "Microsoft.Office.Interop.Excel.Worksheet is not defined"
What I want to do is to run the file without the errors so that I can import and export data from excel to vb.net datagridview. I am using Excel 2010 and visual studio 2010
How do I get around this error so I can run the file?
Yes, you are right. You need Excel to be installed to use the Excel Manipulation feature with Microsoft. Office. Interop.
Add COM reference Microsoft.Office.Interop.Excel to your project, it's called Microsoft Excel XX.Y Object Library (XX.Y is version number depending of installed Excel).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With