(Solved) – Create PDF File, Attach in Out

  • by
(solved)-–-create-pdf-file,-attach-in-out

Please help.

My code below should do the following:

1.Save Sheet1 as a PDF file. No problems here

2.Outlook should get the recently saved PDF file and attach in new mail ready to send.

Thanks in advance,

JW

I am using MSoffice 2013

Sub Create_PDF_Attach_In_outlook_And_Send ()

    Dim outlookOBJ As Object
    Dim mItem As Object
    Set outlookOBJ = CreateObject("outlook.application")
    Set mItem = outlookOBJ.CreateItem(olMailItem)


    Sheet1.ExportAsFixedFormat Type:=xlTypePDF, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=True, _
    Filename:=Sheet1.Range("L7").Value

    With mItem
    .To = Sheet1.Range("O8").Value
    .CC = Sheet1.Range("O9").Value
    .Subject = Filename
    .Attachments.Add **????**
    .Body = "Enter Body Text"
    .Display

    End With

    Set outlookOBJ = Nothing
    Set mItem = Nothing

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *