G
Guest
I have the following code to send two seperate emails:
***Start Code***
'1St Email
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = "(e-mail address removed)"
.Subject = "Test subject1"
.BodyFormat = olFormatPlain
.Body = "Narrative in here."
.Attachments.Add "Tess1.pdf"
.Send
End With
'2nd Email
'Dim olApp As Outlook.Application
'Dim objMail As Outlook.MailItem
'Set olApp = Outlook.Application
'Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = "(e-mail address removed)"
.Subject = "Test subject2"
.BodyFormat = olFormatPlain
.Body = "Narrative in here."
.Attachments.Add "Test2.pdf"
.Send
End With
***End Code***
When I comment out the code as shown Access habgs, when I leave it in I get
this message:
Duplicate declaration in current scope.
I have tried various other syntax but cannot seem to get it right. Can you
help?
Thanks in advance.
***Start Code***
'1St Email
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = "(e-mail address removed)"
.Subject = "Test subject1"
.BodyFormat = olFormatPlain
.Body = "Narrative in here."
.Attachments.Add "Tess1.pdf"
.Send
End With
'2nd Email
'Dim olApp As Outlook.Application
'Dim objMail As Outlook.MailItem
'Set olApp = Outlook.Application
'Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = "(e-mail address removed)"
.Subject = "Test subject2"
.BodyFormat = olFormatPlain
.Body = "Narrative in here."
.Attachments.Add "Test2.pdf"
.Send
End With
***End Code***
When I comment out the code as shown Access habgs, when I leave it in I get
this message:
Duplicate declaration in current scope.
I have tried various other syntax but cannot seem to get it right. Can you
help?
Thanks in advance.