Results 1 to 2 of 2

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

  1. #1

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



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •