This question is indirectly related to Excel so I hope I'm posting in the right place. This is actually in a desktop-based application. I'm trying to retrieve information from an Excel document where the information will not always be in the same place.
This is what I have:
My problem is with the FindNext(After:=Excel.ActiveWindow.ActiveCell) part. I have tried telling it to use the active cell among other things but it still gives me the error "unable to get the FindNext property of the range class". It works find without the After property specified but then it always brings up the first instance of what I'm looking for. I tried starting a new Find specifying the after property appropriately and had the same problem. Does anyone have any other suggestions as to why it's not working?Code:Dim Excel As Object = CreateObject("Excel.Application") Dim WorkBook As Object = Excel.Workbooks.Open(filePath) Dim WorkSheet As Object = WorkBook.Worksheets(1) WorkBook = GetObject(filePath) WorkSheet = WorkBook.Worksheets(1) 'Determine the name of the first account and the range of rows where it's transactions are. WorkSheet.Cells.Find("Account name: ").Activate Dim Acnt1 As Integer = Excel.ActiveWindow.ActiveCell.row() Dim Acnt2 As Integer = WorkSheet.Cells.FindNext(After:=Excel.ActiveWindow.ActiveCell).row()
Thanks,
--Rikki




Reply With Quote