Sending two email attachements in ms access 2002

C

CAM

Below is my code for sending an email that poplulates the email address,
subject and description and attaches a pdf file via command button and it
works great, but I want to send two pdf or excel attachements at the same
time. How do I do that? any tips will be appreciated. Thank you in
advance.

Cheers


Private Sub eMail_Click()

On Error GoTo Err_eMail_Click
Dim sFile As String
Dim email As String
Dim ref As String
Dim PeriodFrom As String
Dim PeriodEnded As String
Dim Receiver As String
Dim When As String
Dim Who As String
Dim Bywhen As String
Dim Importance As String
Dim Reporter As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

email = txteMailRecipient
ref = "eBill from Corporate Services USA"
PeriodFrom = txtPeriodFrom
PeriodEnded = txtPeriodEnded
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
..To = email
..Subject = ref & " "
..Body = "Attached is your Bill for Product and Services from " &
txtPeriodFrom & " to " & txtPeriodEnded & " . If you need further
assistance, please call us @ (888) 888-8888. Thank you." & vbCr & vbCr &
"Sincerely," & vbCr & vbCr & "Corporate Services Department" & vbCr & "" &
vbCr & ""
..Display
..Attachments.Add ("C:\ Data\Electronic Bills\ACME\2009\Current PDF\Billing
Summary.pdf")

End With

Exit_eMail_Click:
Exit Sub

Err_eMail_Click:
MsgBox Err.Description
Resume Exit_eMail_Click


End Sub
 
D

Dirk Goldgar

CAM said:
Below is my code for sending an email that poplulates the email address,
subject and description and attaches a pdf file via command button and it
works great, but I want to send two pdf or excel attachements at the same
time. How do I do that? any tips will be appreciated. Thank you in
advance.

Cheers


Private Sub eMail_Click()

On Error GoTo Err_eMail_Click
Dim sFile As String
Dim email As String
Dim ref As String
Dim PeriodFrom As String
Dim PeriodEnded As String
Dim Receiver As String
Dim When As String
Dim Who As String
Dim Bywhen As String
Dim Importance As String
Dim Reporter As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

email = txteMailRecipient
ref = "eBill from Corporate Services USA"
PeriodFrom = txtPeriodFrom
PeriodEnded = txtPeriodEnded
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = email
.Subject = ref & " "
.Body = "Attached is your Bill for Product and Services from " &
txtPeriodFrom & " to " & txtPeriodEnded & " . If you need further
assistance, please call us @ (888) 888-8888. Thank you." & vbCr & vbCr &
"Sincerely," & vbCr & vbCr & "Corporate Services Department" & vbCr & "" &
vbCr & ""
.Display
.Attachments.Add ("C:\ Data\Electronic Bills\ACME\2009\Current PDF\Billing
Summary.pdf")

End With

Exit_eMail_Click:
Exit Sub

Err_eMail_Click:
MsgBox Err.Description
Resume Exit_eMail_Click


End Sub


Have you tried just adding a second ".Attachments.Add" line? You have this
one already:
.Attachments.Add ("C:\ Data\Electronic Bills\ACME\2009\Current PDF\Billing
Summary.pdf")

I'm a little surprised that you have that line after your call to the
..Display method. Maybe you should move the ".Display" line after the lines
that add the attachments.
 
C

CAM

Dirk,

I added another .Attachments.Add line works great. Also thanks for the tip
regarding display.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top