VBA Outlook: Extract email header into word & then merge with existing pdf file


New member
Apr 7, 2016
Reaction score
Hello There,

I have a requirement in MS Outlook, which seems difficult and don't know how to go about it. I was wondering if this could be achieved using VBA macro.

Current situation:
1. Emails have a Invoice file attachment (.pdf) and certain text in the email body.
2. There is a external system which extracts the attached .pdf and deletes the email.
3. During this process the email body is lost.

Requirement: The email body should also be send along with the invoice pdf

I thought of the below possible VBA Outlook solution:
Pre-requisite: There should be a temp folder (eg. C:\temp)

1. Check above temp folder exists. If yes follow below steps or give message and stop
2. Search the email if it has a .pdf attachment as an extension, if yes follow below steps
(a) Save the attached .pdf from the email in the temp folder
3. (a) Create a ms word file in the temp folder
(b) Extract the email body + other details such as
From, To, Date send & Subject
(c) & Save as email.doc file
4. In the temp folder, merge the email.doc at the end of the .pdf file
5. Rename the merged .pdf file (eg. Old filename + 'NEW'.pdf)
6. Attach the new merged .pdf file in the email.
7. Send the email to a specified email id (eg. invoices @ system.nl)
8. Go to the next email and repeat the above steps

I went through XGuru site and then downloaded PDFCreator. Have no clue how to go about it.

I look forward for your support. Appreciate your help.

Thanks & best regards,