robertb_NZ
Well-known member
I am writing a VB.NET program that opens a spreadsheet, and then gets various information from it based on user actions. For example, to get the first data row, the program uses
This all works correctly when the user selects a row, but I would like to know if they simply click the [Next] button without doing so. How do I do this? I'd like to set the value of ActiveCell so that it returns Nothing until a selection is made, but it's a read-only property.
Thank you, Robert.
Dim xlApp As Excel.Application = New Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlWorkBook = xlApp.Workbooks.Open(txtFilename.Text)
xlWorkSheet = xlWorkBook.Worksheets(1) 'Get first (or only) spreadsheet
xlApp.Visible = True
Dialog asking the user to select the first data row. thenDim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlWorkBook = xlApp.Workbooks.Open(txtFilename.Text)
xlWorkSheet = xlWorkBook.Worksheets(1) 'Get first (or only) spreadsheet
xlApp.Visible = True
FirstDataRow = xlApp.ActiveCell.Row
This all works correctly when the user selects a row, but I would like to know if they simply click the [Next] button without doing so. How do I do this? I'd like to set the value of ActiveCell so that it returns Nothing until a selection is made, but it's a read-only property.
Thank you, Robert.