Hi all,
I'm currently using the following script to attempt to send the contents of an Excel Spreadsheet as the body of text within an email.
Whenever I run the code I get Error 424 'Object Missing' at this line of code:
I have the CDO Library enabled.
My question is twofold:
How do I make the above script functional and working and...
How can I get it to copy the contents of the Spreadsheet and paste it as the body of the email, then send the email, all without user input.
Your assistance is much appreciated.
I'm currently using the following script to attempt to send the contents of an Excel Spreadsheet as the body of text within an email.
Code:
Sub CommandButton1()
Dim NewMail As CDO.Message
Set NewMail = New CDO.Message
'Enable SSL Authentication
NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
'Make SMTP authentication Enabled=true (1)
NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Set the SMTP server and port Details
'To get these details you can get on Settings Page of your Yahoo Account
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.yahoo.com"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Set your credentials of your Gmail Account
NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxx@xxxx"
NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxxxxxxxxx"
'Update the configuration fields
NewMail.Configuration.Fields.Update
'Set All Email Properties
With NewMail
.Subject = "Test Mail"
.From = "xxxx@xxxx"
.To = "yyyy@yyyy"
.CC = ""
.BCC = ""
.TextBody = "This is a test"
End With
NewMail.Send
MsgBox ("Mail has been Sent")
'Set the NewMail Variable to Nothing
Set NewMail = Nothing
End Sub
Private Sub CommandButton2_Click()
End Sub
Code:
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.yahoo.com"
My question is twofold:
How do I make the above script functional and working and...
How can I get it to copy the contents of the Spreadsheet and paste it as the body of the email, then send the email, all without user input.
Your assistance is much appreciated.