I want to grab a unique value from Outlook mail, look for that value in a column of an Excel file, and return an associated value.
I am working with the .find function from the Excel library to lookup my unique value. find is supposed to return a range of the first occurrence of my value but I cannot assign that value to the variable: pointer.
How can I reference it?
Sub OTM1S() '(ByVal Item As Object)
Dim xlApp As Object
Dim wb As Workbook
Dim pointer As Range
Set xlApp = CreateObject("Excel.Application")
Set wb = xlApp.Workbooks.Open("I:\referencefile.xlsx")
'On Error Resume Next
pointer = wb.Sheets("Bonds").Range("A1:A10000").Find("XS1058142081")
MsgBox pointer.Offset(0, 1)
'On Error GoTo 0
wb.Save
wb.Close
End Sub