Shalih
New Member
- Joined
- Mar 2, 2011
- Messages
- 16
I need some help on figuring out how to send an email through Excel without getting the Microsoft Security message that asks you to Allow the message to be sent.
I do not need any third party tool to be installed. Please help.
[
Sub Try_this()
Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem
Dim ToContact As Outlook.Recipient
Sheets("Sheet1").Select
Range("C1").Select
Selection.End(xlDown).Select
v_end = ActiveCell.Row
v_month = Month(Range("d1").Value)
v_day = Day(Range("d1").Value)
For i = 1 To v_end
v_check_month = Month(Range("C" & i).Value)
v_check_day = Day(Range("C" & i).Value)
If v_check_month = v_month And v_check_day = v_day Then
Set OLF = GetObject("", _
"Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add
With olMailItem
.Subject = "You have a birthday Reminder"
strEmail = "mohammed.shalih@xxxx.com"
Subject = "Hi"
Set ToContact = .Recipients.Add(mohammed.shalih@xxxx.com)
.Body = Range("B" & i).Value & Chr(13)
.Send
End With
Set ToContact = Nothing
Set olMailItem = Nothing
Set OLF = Nothing
End If
Next i
End Sub
]
I do not need any third party tool to be installed. Please help.
[
Sub Try_this()
Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem
Dim ToContact As Outlook.Recipient
Sheets("Sheet1").Select
Range("C1").Select
Selection.End(xlDown).Select
v_end = ActiveCell.Row
v_month = Month(Range("d1").Value)
v_day = Day(Range("d1").Value)
For i = 1 To v_end
v_check_month = Month(Range("C" & i).Value)
v_check_day = Day(Range("C" & i).Value)
If v_check_month = v_month And v_check_day = v_day Then
Set OLF = GetObject("", _
"Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add
With olMailItem
.Subject = "You have a birthday Reminder"
strEmail = "mohammed.shalih@xxxx.com"
Subject = "Hi"
Set ToContact = .Recipients.Add(mohammed.shalih@xxxx.com)
.Body = Range("B" & i).Value & Chr(13)
.Send
End With
Set ToContact = Nothing
Set olMailItem = Nothing
Set OLF = Nothing
End If
Next i
End Sub
]