Print email first page with the headers in outlook

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
756
Office Version
  1. 365
Hi,

Found the code below in the internet works fine the only problem is that doesn't include the header, can it modify that include the headers as well like the attached picture, when print missing that.

here is the code:


VBA Code:
Public Sub PrintFirstPage(Mail As Outlook.MailItem)
  Dim wdApp As Word.Application
  Dim wdDoc As Word.Document
  Dim olDoc As Word.Document
 
  Set wdApp = CreateObject("Word.Application")
  Set wdDoc = wdApp.Documents.Add(Visible:=True)
 
  Set olDoc = Mail.GetInspector.WordEditor
  olDoc.Range.Copy
  wdDoc.Range.Paste
 
  wdDoc.PrintOut Range:=wdPrintFromTo, From:="1", To:="1"
 
  DoEvents
  wdDoc.Close False
  wdApp.Quit
End Sub

thank you,
 

Attachments

  • email header.PNG
    email header.PNG
    5.6 KB · Views: 8

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,203,236
Messages
6,054,298
Members
444,715
Latest member
GlitchHawk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top