I am trying to run the script but I am getting this error.
Compile error
Can’t find project or library.
when I go to add the library
Tools -> references to add object library (Microsoft Outlook 11.0 Object Library) I get this error
Name conflicts with existing module, project, or object library.
How I can solve this problem. Any help would be appreciated to solve this problem.
The code I am using is below
VB:
--------------------------------------------------------------------------------
Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
'
Set objOL = New Outlook.Application
'
Dim i As Integer
Dim PhoneNumber As Variant
'
i = 2
While ActiveSheet.Cells(i, 1) <> ""
PhoneNumber = ActiveSheet.Cells(i, 1)
Set objMail = objOL.CreateItem(olMailItem)
With objMail
If ActiveSheet.Cells(i, 1) <> "" Then
.To = PhoneNumber
.Subject = "Automated Mail Response"
.Body = "This is an automated message from Excel. " & _
"Please update your Planet EV Design Template it is due tomorrow"
.Send
End If
End With
'
Set objMail = Nothing
'
i = i + 1
Wend
Set objOL = Nothing
End Sub
--------------------------------------------------------------------------------
Thanks
Bookmarks