What is wrong with this code??
-
Private Sub Image1_Click() Dim SMTP As Object Set SMTP = CreateObject("ANSMTP.Mail") SMTP.ServerAddr = "pophm.sympatico.ca" SMTP.FromAddr = "email@email.com" 'sender' email address SMTP.AddRecipient "Me", "email@email.com", 0 SMTP.BodyFormat = 1 SMTP.Subject = Text1.Text & Text2.Text SMTP.BodyText = Text1.Caption & Text2.Caption If SMTP.SendMail() = 0 Then 'send email MsgBox "Email delivered", vbOKOnly, "ANSMTP COM Object" Else MsgBox SMTP.GetLastErrDescription, vbOKOnly, "ANSMTP COM Object" End If End Sub
When I try and run it it gives me a run-time error #429. I debug it and it highlights the third line. (Set SMTP = CreateObject...) Hengy I like Pie -
Private Sub Image1_Click() Dim SMTP As Object Set SMTP = CreateObject("ANSMTP.Mail") SMTP.ServerAddr = "pophm.sympatico.ca" SMTP.FromAddr = "email@email.com" 'sender' email address SMTP.AddRecipient "Me", "email@email.com", 0 SMTP.BodyFormat = 1 SMTP.Subject = Text1.Text & Text2.Text SMTP.BodyText = Text1.Caption & Text2.Caption If SMTP.SendMail() = 0 Then 'send email MsgBox "Email delivered", vbOKOnly, "ANSMTP COM Object" Else MsgBox SMTP.GetLastErrDescription, vbOKOnly, "ANSMTP COM Object" End If End Sub
When I try and run it it gives me a run-time error #429. I debug it and it highlights the third line. (Set SMTP = CreateObject...) Hengy I like Pie