Hi,
I've been using the same workbook code for years without trouble. recently the macro in the workbook begain throwing the error code 1004.
Run Time Error ‘1004’:
Unable to get the vlookup property of the WorksheetFunction class
The code is below. Please help me sort it out.
Thanks,
Tom
I've been using the same workbook code for years without trouble. recently the macro in the workbook begain throwing the error code 1004.
Run Time Error ‘1004’:
Unable to get the vlookup property of the WorksheetFunction class
The code is below. Please help me sort it out.
Code:
Sub Mail_small_Text_Outlook()
Sheet3.Activate
Dim LastRow As Integer
Dim MyName As String
Dim MyEmail As String
Dim MyTempEmail As String
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
'///////////////////////////////////////////////////////
LastRow = Sheet3.Range("N65536").End(xlUp).Row
For i = 2 To LastRow
If Cells(i, 10) <> "" And Cells(i, 14).Value <> "Complete" And Cells(i, 14).Value <> "Expired" Then
MyName = Cells(i, 10).Value
MyTempEmail = (Application.WorksheetFunction.VLookup(MyName, Sheet5.Range("E5 : F17"), 2, False))
If InStr(1, UCase$(MyEmail), UCase$(MyTempEmail)) = 0 Then
MyEmail = MyTempEmail & "; " & MyEmail
End If
End If
Next i
<SNIP>
Thanks,
Tom