Hi y'all, I'm new to the forum and need help with what seemingly should be an easy problem but hasn't been.
Here is the setup:
*Row 1 has column headers (Site number, Customer name, Order number, etc.)
*Column A contains specific site numbers
*Columns B-S have specific elements in each column related to the site numbers (customer name, order number, etc.)
*Column R has multiple email addresses in each cell that correspond with the site number in each row (site 123 in column A2 has 5 email recipient address in cell R2 and so on)
Using VBA with Auto.Filter, the goal:
*Filter each site in column A, which could have more than one order
*Copy header row and the row(s) of customer orders and columns A:S for each filtered site
*Paste data into an email as a table
*Copy the email addresses in column R then paste into the "To" field in the outlook email
I have everything else working but I'm stuck on pulling the email address out separately. The code I'm trying:
Set oOutApp = CreateObject("Outlook.Application")
Set oMailItem = oOutApp.CreateItem(0)
With oMailItem
.SentOnBehalfOfName = "Carmen@domain.com"
.To = range.AutoFilter Field:=1, Criteria1:=ActiveCell.Value
.Subject = "Action Required - Order Review"
.BodyFormat = 2
.Display
End With
I'm getting a Compile error: Expected: end of statement with "Field" highlighted...what's wrong? Any help you can provide would be greatly appreciated!
Thanks!
Carmen
Bookmarks