I am writing a vba sub in outlook that will: grab a unique value from the mail, look for that value in the column of an excel file, and return an associated value. I am working with an the .find function from the excel library to lookup my unique value in the excel, however, find is supposed to return a range of the first occurrence of my value but I cannot assign that value to the variable: pointer. I cannot reference it. Any insights appreciated. thank you!
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