Hi I have two problems excel instance does not close at the end and two when I try to do the looking using text it works but soon as I try using date/time it returns nothing.
any help is appreciated.
thanks
any help is appreciated.
thanks
Code:
Private Sub Command84_Click()
Dim objExcel As Excel.Application
On Error Resume Next
Set objExcel = GetObject(, "Excel.Application")
If Err.Number = 429 Then 'Excel not running - start it
Set objExcel = CreateObject("Excel.Application")
Err.Clear
End If
Dim result As String
Dim A As String
Dim B As String
'A = "03/05/2013 11:26:00"
A = "A"
'A = Format("03/05/2013 11:27:00", "dd/mm/yyyy hh:nn:ss")
B = "A1:C100"
'Sheets("Test").Activate
'vlookupVBA = Application.WorksheetFunction.VLookup(lookupValue, table_lookup, colOffset, False)
'result = vlookupVBA(A, B, 2)
objExcel.Workbooks.Open "C:\Test.csv", True, False
objExcel.Visible = False
Sheets("Test").Activate
'result = "#N/A"
'With Workbooks("C:\Test.csv").ActiveSheet
Dim myrange As Range
Set myrange = Range("A1:C100")
result = objExcel.Application.VLookup(A, myrange, 3, False)
'result = objExcel.Workbooks("C:\Test.csv").Worksheets("Test").Range("A1:C100")
MsgBox result
ActiveWorkbook.Close SaveChanges:=False
objExcel.Application.Quit
'objExcel.Workbooks.Close
'objExcel.Quit
'End With
Set objExcel = Nothing
End Sub