مجموعة من برامج جداول بيانات Microsoft مع أدوات لتحليل البيانات وتخطيطها وتوصيلها.
السلام عليكم
هناك vba codes
كثيره تستخدم فى هذا الغرض ومنها
هذا الكود
======
Public Subject As String
Public ToEmailID As String
Public EmailBody As String
Public ToName As String
Sub SendEmailUsingOutlook(Subject As String, ToEmailID As String, EmailBody As String)
Dim OlApp As New Outlook.Application
Dim myNameSp As Outlook.Namespace
Dim myInbox As Outlook.MAPIFolder
Dim myExplorer As Outlook.Explorer
Dim NewMail As Outlook.MailItem
Dim OutOpen As Boolean
' Check to see if there's an explorer window open
' If not then open up a new one
OutOpen = True
Set myExplorer = OlApp.ActiveExplorer
If TypeName(myExplorer) = "Nothing" Then
OutOpen = False
Set myNameSp = OlApp.GetNamespace("MAPI")
Set myInbox = myNameSp.GetDefaultFolder(olFolderInbox)
Set myExplorer = myInbox.GetExplorer
End If
'myExplorer.Display ' You don't have to show Outlook to use it
' Create a new mail message item.
Set NewMail = OlApp.CreateItem(olMailItem)
With NewMail
'.Display ' You don't have to show the e-mail to send it
.Subject = Subject
.To = ToEmailID
.Body = EmailBody
End With
NewMail.Send
If Not OutOpen Then OlApp.Quit
'Release memory.
Set OlApp = Nothing
Set myNameSp = Nothing
Set myInbox = Nothing
Set myExplorer = Nothing
Set NewMail = Nothing
End Sub
Sub auto_open()
Dim iRow
iRow = 4
Sheets("Sheet1").Activate
On Error Resume Next
If Sheet1.Label1.Caption <> VBA.Date Then
While Range("C" & iRow).Value <> ""
If Range("G" & iRow).Value <> "Completed" And Range("H" & iRow).Value < VBA.Date Then
ToName = Range("E" & iRow).Value
ToEmailID = Range("F" & iRow).Value
Subject = "Task Not Completed"
EmailBody = "Hi " & ToName & "," & vbNewLine & vbNewLine
EmailBody = EmailBody & "Following Task is still not Completed. The task completion date was on :" _
& Range("H" & iRow).Value & vbNewLine & vbNewLine
EmailBody = EmailBody & Range("C" & iRow).Value & " : " & Range("D" & iRow).Value & vbNewLine & vbNewLine
EmailBody = EmailBody & "Regards," & vbNewLine
Call SendEmailUsingOutlook(Subject, ToEmailID, EmailBody)
End If
iRow = iRow + 1
Wend
Sheet1.Label1.Caption = CStr(VBA.Date)
ThisWorkbook.Save
ThisWorkbook.Close
Else
End If
End Sub
====
للامانه هذا الكود منقول من هذا الموقع
http://www.learnexcelmacro.com/wp/2012/06/send-email-automatically/