VBA Outlook: Send email header to pdf using wrdApp.ActiveDocument.ExportAsFixedFormat

Inddon

New member
Joined
Apr 7, 2016
Messages
4
Reaction score
0
Points
0
Hello There,

I am using a VBA code to export contents of email to a pdf file as below:
Code:
        'Save as pdf
        wrdApp.ActiveDocument.ExportAsFixedFormat OutputFileName:= _
            strCurrentFile, ExportFormat:= _
            wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
            wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
            Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
            CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
            BitmapMissingFonts:=True, UseISO19005_1:=False

With the above code, it send the entire email. I want only the below email header in the pdf file:
From:
To:
Date:
Subject:


Could you please guide in how to modify the above code. Appreciate your help

Thanks
Don
 
Hello There,

Came across the solution, where I just wanted to have the email header. Sharing the code is as below:

Code:
        'Remove the lines. Start from the 5th line to the end . This means keep only the first 4 lines
        wrdDoc.Range(wrdDoc.Paragraphs(5).Range.Start, wrdDoc.Range.End).Cut


'Save as pdf wrdApp.ActiveDocument.ExportAsFixedFormat OutputFileName:= _  strCurrentFile, ExportFormat:= _  wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _  wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _  Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _  CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _  BitmapMissingFonts:=True, UseISO19005_1:=False

Regards,
Don
 
Back
Top