Hi,
I want to send an email to different individuals and the body content is different for each individual, I'm getting a problem with the second part of my code:
The code errors out at the second instance of sending an email ".To = "Hari.Govindan@domesticandgeneral.com" "
Is it not possible to send emails in this way within access or is there another way to do this.
Any Assistance wouldbe most appreciated.
Regards
John
I want to send an email to different individuals and the body content is different for each individual, I'm getting a problem with the second part of my code:
Code:
Dim olApp As Outlook.Application 'Declare the outlook application variable
Dim olMail As MailItem 'Declare the Mail Item variable
Set olApp = New Outlook.Application 'Set the olApp to a new outlook application
Set olMail = olApp.CreateItem(olMailItem) 'Set the olMail to create an outlook mail item
With olMail 'Create and sends the email
.To = "[EMAIL="Matthew.Ashcroft@domesticandgeneral.com"]Matthew.Ashcroft@domesticandgeneral.com[/EMAIL]" 'Address the email to [EMAIL="Matthew.Ashcroft@domesticandgeneral.com"]Matthew.Ashcroft@domesticandgeneral.com[/EMAIL]
.CC = "[EMAIL="Olga.potaptseva@domesticandgeneral.com"]Olga.potaptseva@domesticandgeneral.com[/EMAIL]" 'Copy the email to [EMAIL="Olga.Potaptseva@domestigandgeneral.com"]Olga.Potaptseva@domestigandgeneral.com[/EMAIL]
.BCC = "[EMAIL="elaine.boulton@domesticandgeneral.com"]elaine.boulton@domesticandgeneral.com[/EMAIL]" 'Copy the email to [EMAIL="elaine.boulton@domesticandgeneral.com"]elaine.boulton@domesticandgeneral.com[/EMAIL]
.Subject = "Marketing - Monthly Scanned Volumes Report" 'Provide the subject matter for the email
.Body = "Good Day," & vbCrLf & vbCrLf & "The Monthly Volumes Report is now available in the \Marketing\ScanMthVols Folder." & vbCrLf & _
"This file is in snapshot format, if you don't have snapshot the snpvw.exe file it is located in the Questionniars drive. " & vbCrLf & _
"Copy it to your PC and double click on the snpvw.exe to install it, then you will be able to open it" & vbCrLf & vbCrLf & vbCrLf & _
"Scanning Operations" & vbCrLf & _
"Domestic & General" 'Provide the text body for the email
.Send 'Send the email
End With
With olMail
.To = "[EMAIL="Hari.Govindan@domesticandgeneral.com"]Hari.Govindan@domesticandgeneral.com[/EMAIL]" 'Address email to [EMAIL="Hari.Govindan@domesticandgeneral.com"]Hari.Govindan@domesticandgeneral.com[/EMAIL]
.CC = "[EMAIL="Karen.Page@domesticandgeneral.com"]Karen.Page@domesticandgeneral.com[/EMAIL]" 'Copy the email to [EMAIL="Karen.Page@domesticandgeneral.com"]Karen.Page@domesticandgeneral.com[/EMAIL]
.BCC = "[EMAIL="elaine.boulton@domesticandgeneral.com"]elaine.boulton@domesticandgeneral.com[/EMAIL]" 'Copy the email to [EMAIL="elaine.boulton@domesticandgeneral.com"]elaine.boulton@domesticandgeneral.com[/EMAIL]
.Subject = "Service - Monthly Scanned Volumes Report" 'Provide the subject matter for the email
.Body = "Good Day," & vbCrLf & vbCrLf & "The Monthly Volumes Report is now available in the \Customer Satisfaction\ScanMthVols Folder." & vbCrLf & _
"This file is in snapshot format, if you don't have snapshot the snpvw.exe file it is located in the Questionniars drive. " & vbCrLf & _
"Copy it to your PC and double click on the snpvw.exe to install it, then you will be able to open it" & vbCrLf & vbCrLf & vbCrLf & _
"Scanning Operations" & vbCrLf & _
"Domestic & General" 'Provide the text body for the email
.Send
End With
The code errors out at the second instance of sending an email ".To = "Hari.Govindan@domesticandgeneral.com" "
Is it not possible to send emails in this way within access or is there another way to do this.
Any Assistance wouldbe most appreciated.
Regards
John