Within a VB.net application, I need to open a simple csv file in ms-excel. However the following leaves the Import faded and both DIM statements give the compile error “undefined”:
red-wiggly underlines.
<code> Imports Microsoft.Office.Interop
public class...
Sub btnOpenfile_click()
Dim oxl As Excel.Application
Dim owb As Excel.Workbook
oxl = CreateObject("Excel.Application")
oxl.Visible = True
owb = oxl.Workbooks.Open("G:NTPC.csv")
End Sub
End class
</code>
<code> Imports Microsoft.Office.Interop
public class...
Sub btnOpenfile_click()
Dim oxl As Excel.Application
Dim owb As Excel.Workbook
oxl = CreateObject("Excel.Application")
oxl.Visible = True
owb = oxl.Workbooks.Open("G:NTPC.csv")
End Sub
End class
</code>
Imports Microsoft.Office.Interop
public class...
Sub btnOpenfile_click()
Dim oxl As Excel.Application
Dim owb As Excel.Workbook
oxl = CreateObject("Excel.Application")
oxl.Visible = True
owb = oxl.Workbooks.Open("G:NTPC.csv")
End Sub
End class
I’ve tried adding a reference to “Microsoft Office 16.0 Object Library” to no avail. This does not help either
<code>Imports Microsoft.Office.Interop.Excel
</code>
<code>Imports Microsoft.Office.Interop.Excel
</code>
Imports Microsoft.Office.Interop.Excel
Any hints on what’s missing will be appreciated.