How to print excel file from VB.net

How to print excel file from VB.net, some times you need to print an excel file which may be exported by your application, to do that use the following function by eng. Fakhri .

Some times when you use the following code “Imports Excel = Microsoft.Office.Interop.Excel”  to import excel library which is used to do export and import from excel sheet, an error appears

VB.Net How to Export Datagridview to Excel

Datagridview is agreet ActiveX that you can show your data result set in a user friendly table, here an example that shows how you can export Datagridview table rows to Microsoft Excel Sheet .