OK I have been gooding for over 8 hours trying to figure this out. Bare with me I do not work with arrays much.
I have brought an array in from a range in excel. This works fine. Through debugging i can see the values are brought in correctly.
Issue is I want to see if a string exists within that array (or cells).
I have tried lots of things and pretty much mutilated my code but here it is:
Just a note the part in green works but i think its just a messy way to do it. Im trying to step up my skills a bit .
(edited a bit to remove my name)
Thanks for the help.
I have brought an array in from a range in excel. This works fine. Through debugging i can see the values are brought in correctly.
Issue is I want to see if a string exists within that array (or cells).
I have tried lots of things and pretty much mutilated my code but here it is:
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim folderinfo As String
Dim filename As String
Dim Reportpath As String
Dim arrdata As Array
Reportpath = ("~Visual Studio 2008\Projects\Tech Works\Tech Works\Paperwork\")
filename = Pickworder.Text
folderinfo = ("~\Visual Studio 2008\Projects\Tech Works\Tech Works\work orders\") '(Application.StartupPath & "\work orders\")
Dim excel As New Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
excel = New Microsoft.Office.Interop.Excel.Application
wb = excel.Workbooks.Open(folderinfo & filename)
excel.Visible = True
wb.Activate()
arrdata = excel.Range("A31:A33").Value
' If arrdata.ToString Like RT Then
'MessageBox.Show("test")
'End If
'If excel.Range("A31:A32").Value.ToString.Contains("RT") > 0 Then
'MessageBox.Show("test")
' End If
'If excel.Range("A31", "A33").Value.ToString Is "RT" Then
'MessageBox.Show("test")
'End If
[COLOR="Lime"]If excel.Range("A31").Value Like "RT" Then
excel.Workbooks.Open(Reportpath & "RT.xls")
ElseIf excel.Range("A32").Value Like "RT" Then
excel.Workbooks.Open(Reportpath & "RT.xls")
ElseIf excel.Range("A33").Value Like "RT" Then
excel.Workbooks.Open(Reportpath & "RT.xls")
End If[/COLOR]
'MessageBox.Show(Application.ExecutablePath) testing purposes
'MessageBox.Show(Environment.GetFolderPath(Environment.SpecialFolder.Personal)) Get my docs directory
End Sub
Just a note the part in green works but i think its just a messy way to do it. Im trying to step up my skills a bit .
(edited a bit to remove my name)
Thanks for the help.