Send email based on Excel (Error 438)



Can you help me please why I get this error: excel macro error 438 object doesn t support this property or method I got this code from this video: http://ift.tt/1KIaVCS


Please help me


Sub SendEmail(what_address As String, subject_line As String, mail_body As String) ' ' SendEmail Macro '


' Dim olApp As Outlook.Application Set olApp = CreateObject("Outlook.Application")



Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)

olMail.To = what_address
olMail.Subjeect = subject_line
olMail.Body = mail_body
olMail.Send


End Sub Sub SendMassEmail()


row_number = 1


Do DoEvents row_number = row_number + 1 Dim mail_body_message As String Dim ip_address As String



mail_body_message = Sheet1.Range("J2")
ip_address = Sheet1.Range("D" & row_number)
mail_body_message = Replace(mail_body_message, "ip_address", ip_address)
MsgBox mail_body_message

'Call SendEmail(Sheet1.Range("A" & row_number), "This is a test e-mail", Sheet1.Range("J2"))


Loop Until row_number = 6


MsgBox = "Complete!"


End Sub


No comments:

Post a Comment