Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

extract attached document email

Forum home » Delegate support and help forum » Microsoft VBA Training and help » Extract attached document from Email and Copy-Paste it to Excel

Extract attached document from Email and Copy-Paste it to Excel

ResolvedVersion 2010

Josselin has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

Extract attached document from Email and Copy-Paste it to Excel

Good evening,
I've recently attended the beginner/intermediate VBA training course and have questions concerning the extraction of attached document from Email and Copy/Paste them into Excel to be analysed.
Indeed, on a daily basis I receive a series of reports which contain a PDF document. These report all contains today's date and I'd like to extract this PDF document from the Email open it, select all document, copy paste it into a worksheet in Excel and do the same for another day in a different worksheet and so on for the week, them my Macro will do the rest.
Can you please tell me if there is an application/code which can extract PDF document from email and copy-paste it into Excel?
Thank you in advance,
Regards,
Josselin Coupier

RE: Extract attached document from Email and Copy-Paste it to Ex

Hi Joss

Thanks for getting in touch. Good to hear from you again.

This should be possible but it's probably easier to initiate this code from Outlook. You can manipulate all Office applications with VBA. The majority of structures are the same (IF THEN, DO LOOP etc) but the objects will be different (instead of ActiveCell you will have MailItem etc).

This is quite a broad topic. You've got two parts here: (1) get the attachment from the email (2) extract to Excel. I have a few links that might help:

http://stackoverflow.com/questions/7890612/vba-code-to-save-an-attachment-excel-file-from-an-outlook-email-that-was-insid

Also Ron DeBruin's site has many examples for working with this:

http://www.rondebruin.nl/win/section1.htm

Read up on the subject and let me know if you have a specific issue.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Edited on Tue 8 Apr 2014, 12:32

RE: Extract attached document from Email and Copy-Paste it to Ex

.

Wed 26 Mar 2014: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

VBA tip:

Use VbNullString instead of

When needing to default a String variable back to it's default of "" use vbNullString as in the following example:

Sub ClearText()

Dim strEmpName As String

strEmpName = "John Smith"
MsgBox strEmpName

strEmpName = vbNullString
MsgBox strEmpName

End Sub

View all VBA hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.