I have a data in list at vb.net and i want export to Excell. I have tried the code from Jx_man in thread "Export Data from listbox to Excel" , but it can't worked.

Dim MsExcel As Excel.Application ---> Error Statement is not valid in a namespace
I use Microsoft Excel 12.0 Library Object

Please Help me!!! Thanks...

add this to the very top of your project

Imports Excel = Microsoft.Office.Interop.Excel

make sure Microsoft Excel 12.0 Library Object is referenced in your project under
Project -> add reference