I've used earlier versions of VB (big access database) in the past, but VB.net 2022 is new to me. I've taken this excerpt from Excel and am trying to read it in one sheet. Net-informations.com http://vb.net-informations.com/excel-2007/vb.net_excel_2007_open_file.htm I've added the Microsoft Excel12.0 Object Library.
This code is in a button click event
strFileName = "F:\DarPlr\DlrData.xlsx"
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("strFileName") <<<<<<<exception thrown here
xlWorkSheet = xlWorkBook.Worksheets("sheet1")
'display the cells value B2
'edit the cell with new value
'xlWorkSheet.Cells(2, 2) = "http://vb.net-informations.com"
I get this exception: System.NullReferenceException: Object reference not set to an instance of an object. enter image description here
I tried using every example I could find, but they all contained mistakes of one kind or another. I attempted fixing the faults, but I was unsuccessful. I'm missing something, but I'm not sure what.