whitoulias
Board Regular
- Joined
- Jun 22, 2012
- Messages
- 153
Code:
Sub email()
Dim myOutlook As Object
Dim myMailItem As Object
Dim FName As String
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)
FName = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With otlNewMail
.To = "xxx@www.com;xxx1@www.com"
.CC = ""
.Subject = "new itens "
.Body = "Attached you may find new items expiring in 7 days"
.Attachments.Add FName
.DeferredDeliveryTime = Range("I2")
.Send
End With
Set otlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
End Sub
Good day to all
This code runs fine in order to send an e-mail from outlook while i'm in excel.
I would like to change it a bit
The excel has 4 sheets.
The third sheet is named "new items".
In this sheet in COLUMN K i have numbers and empty cells.
What i would like is when in COLUMN K number "7" exists then copy the enire row- and all other rows with "7" to a new excel named "new items" and send an e-mail to specific receipients with "new items" attached.
I will change the code above in order to run this macro by workbook.open()
Plus i'm thinking of adding a message box if no "7"'s exist
Any thoughts?
Thank you