ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Lookup function to find email addresses (https://www.excelbanter.com/excel-programming/301232-lookup-function-find-email-addresses.html)

Michael McClellan

Lookup function to find email addresses
 
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),'Addres s
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

Frank Kabel

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

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


--
Regards
Frank Kabel
Frankfurt, Germany


Michael McClellan wrote:
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),'Addres s
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




All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com