Lookup function to find email addresses

M

Michael McClellan

Anybody know why the lookup line of this code does not function
properly?

'Enter order electronically with vendors
Dim VendAddr As String
VendAddr = Range("LOOKUP(INDEX(Orders!$F$1:$L$37,7,1),'Address
Lookup Table'!A$1:A$50,'Address Lookup Table'!F$1:F$50)").Value

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = VendAddr
.CC = ""
.BCC = ""
.Subject = "ORDER from HM: " & HMoffice & HMPO
.Body = "Please enter the following order and utilize the
attached packing list." & vbNewLine & _
"Please confirm receipt of order within 24 hours."
'.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
 
F

Frank Kabel

Hi
this line
VendAddr = Range("LOOKUP(INDEX(Orders!$F$1:$L$37,7,1),'Address
Lookup Table'!A$1:A$50,'Address Lookup Table'!F$1:F$50)").Value

can't work. What are you trying to do?
 
Top