Attaching all PDFs in folder to Outlook email using Word VBA

  • Hi


    I want to attach all PDFs in a specific desktop folder to an Outlook email using VBA in Word


    I'm using below code to generate an Outlook email but cant figure out how to write the attachment part.


    Sub Email_Template1()


    Dim oMailItem As Object, oOLapp As Object

    Dim Word As Object, doc As Object, MsgTxt$

    Set oOLapp = CreateObject("Outlook.Application")

    Set oMailItem = oOLapp.CreateItem(0)

    Set Word = CreateObject("word.application")


    With oMailItem

    .To = "Email"

    .cc = "Email"

    .subject = "Needed Confirmation"

    ' .attachment.Add

    .HTMLBody = "test"

    .Display

    End With


    Set oOLapp = Nothing

    Set oMailItem = Nothing


    End Sub