Attachments (1 Viewer)

cmatni

Registered User.
Local time
Today, 13:44
Joined
Dec 11, 2006
Messages
19
Hello,

i have in each record a pth into a pdf file, and i want to send several pdf files as an attachment in an e-mail, any on:eek: e knows how can i do that ?? thank you
 

Moniker

VBA Pro
Local time
Today, 15:44
Joined
Dec 21, 2006
Messages
1,567
Look here for instructions on how to connect to Outlook and add attachments.
 
  • Like
Reactions: fmm

cmatni

Registered User.
Local time
Today, 13:44
Joined
Dec 11, 2006
Messages
19
That is a great and very helpfull code, thank you, but i don't know if you can help me with this issue, my case is:
i have a form and a subform, in the subform several records each one contains a pdf file path, when the user clicks on a button, i want the outlook send window to open and automatically attach all the pdf files in the records (may be a loop) and the user fills in the to : email and subject and body and send it , could that be done just the attachments and outlook send window :eek: pen ? Thanks

Code:
Dim OLApp As New Outlook.Application
    Dim OLMsg As Outlook.MailItem
    
    Set OLMsg = OLApp.CreateItem(olMailItem)
    With OLMsg
        .Recipients.Add "your_email_to_person@their_email_address"
        .Subject = "What you want in the subject line"
        .Attachments.Add Name_of_file_to_attach_if_you_need_to_attach_a_file
        .Body "The_body_text_of_the_email"
        .Send
    End With
    
    MsgBox "Emailing Complete", vbOKOnly + vbInformation, "Email Sent"
    
    Set OLApp = Nothing
    Set OLMsg = Nothing
 

Users who are viewing this thread

Top Bottom