[RESOLVED] Newbie question
Quite simply - why wont this work?
I'm not getting any errors. I've checked and it's definitely opening/referencing the correct excel file. I've kept it this simple just to see if I can get the basics working... (I can't :))
The console is writing out the Not Found message. It's definitely there! I even copied and pasted a load of other 1's around just in case.
Why, oh why???
VB Code:
Imports Excel
Imports Microsoft.Office.Core
Private moApp As Excel.Application
moApp = DirectCast(CreateObject("Excel.Application"), Excel.Application)
moApp.Visible = True
Dim myFileName As String = "D:\My Documents\helpMe2.xls"
Dim oWB As Excel.Workbook = moApp.Workbooks.Open(myFileName)
Dim oSht As Excel.Worksheet = DirectCast(oWB.Sheets("Time"), Excel.Worksheet)
Console.Write("Got here")
If oSht.Cells(3, 1) Is "1" Then 'found, take items from this row and next row
Console.Write("Found Number")
oSht.Cells(5, 6) = "Found"
Else
Console.Write("Nothing Found")
End If
oWB.Close(True, myFileName)
oSht = Nothing
oWB = Nothing
I also tried
Cells.Items
.ToString = "1"
Nothing works. Please put me out of my misery.