Posted 4 July 2023, 1:47 pm EST - Updated 4 July 2023, 1:52 pm EST
I am trying my first run and believe I followed all your instructions. However, I am getting this error on the “MsgBox” line when I try to display a cell. Can you please point me in the right direction? I have also attached 1) and a screenshot of the error; 2) The simple Excel spreadsheet. I am stuck and unable to do anything else with Spread.NET.
“An unhandled exception of type ‘System.NullReferenceException’ occurred in GrapeCity.Spreadsheet.dll. Additional information: Object reference not set to an instance of an object.”
Imports FarPoint.Win.Spread
Imports GrapeCity.Spreadsheet
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim FpSpread1 As New FpSpread()
Dim xlWorkbook As IWorkbook = WorkbookSet.CreateBase1Object(FpSpread1.AsWorkbook()) 'Set 1-base indexing per workbook
Dim MyManifestWorksheet As IWorksheet
FpSpread1.Visible = False 'Hide Spreadsheet
FpSpread1.Open("TestExcelSpreadsheet.xlsx")
MyManifestWorksheet = xlWorkbook.Worksheets("Sheet1")
MsgBox(MyManifestWorksheet.Range(1, 1).Value.ToString)
MsgBox(MyManifestWorksheet.Range("A1").Value.ToString)
FpSpread1.Dispose()
End Sub
End Class