View Single Post
 
Old 01-25-2021, 06:05 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Cross posted at Reload this Page Attaching all PDFs in folder to Outlook email using Word VBA
and Attaching all PDFs in folder to Outlook email using Word VBA - Excel VBA / Macros - OzGrid Free Excel/VBA Help Forum

That's fairly straightforward e.g.

Code:
Dim oMailItem As Object, oOLApp As Object
Dim Word As Object, doc As Object, MsgTxt$
Dim strFile As String
Const strPath As String = "C:\Path\"
    Set oOLApp = CreateObject("Outlook.Application")
    Set oMailItem = oOLApp.CreateItem(0)
    'Set Word = CreateObject("word.application") '?

    With oMailItem
        .To = "Email"
        .CC = "Email"
        .Subject = "Needed Confirmation"
        strFile = Dir$(strPath & "*.pdf")
        While strFile <> ""
            .Attachments.Add strPath & strFile
            strFile = Dir$()
        Wend
        .HTMLBody = "test"
        .Display
    End With

    Set oOLApp = Nothing
    Set oMailItem = Nothing
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote