Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send email with attachments from access

Status
Not open for further replies.

TSO456

Technical User
Jul 23, 2001
57
US
Can someone help me add code to the code bellow that will send pdf files as attachments.


Private Sub Command0_Click()
DoCmd.SendObject acSendNoObject, , , [substitute the recipient's e-mail address here], , , "this is the subject.", "This is the message body. Here is a value from my form: " & Me.[substitute the form object name here] & ".", False
End Sub

Thanks
Jill
 
I looked at the code at the link you sent and it looked fairly complicated for someone like me. Is it possible to add code to my original code that I listed above that sends pdf attachments.

Thanks
Jill
 
Came across this in my code library (a little simpler).....

Sub cmdSendAtt_Click()

Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)

With MailOutLook
.To = "Put your address here"
.Subject = "Your Subject"
.Attachments.Add "C:\Stuff.pdf", olByValue, 1, "Stuff"
.Send
End With
End Sub

Hope this helps
 
What is the syntex to send more than one pdf file using the code below. As you can see I am sending sun.pdf. How can I send another PDF in the same email.
Thanks
Jill


Private Sub Command13_Click()
Dim out As Object

Set out = CreateObject("outlook.application")
With out.createitem(olmailitem)
.recipients.Add "test@hotmail.com"
.subject = "Test Message"
.attachments.Add "c:\temp\sun.pdf"
.send
End With
 
Private Sub Command13_Click()
Dim out As Object

Set out = CreateObject("outlook.application")
With out.createitem(olmailitem)
.recipients.Add "test@hotmail.com"
.subject = "Test Message"
.attachments.Add "c:\temp\sun.pdf"
.attachments.Add "c:\temp\sun.pdf1"
.attachments.Add "c:\temp\sun.pdf2"
.send
End With
 
Thank you that worked. I really appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top