Extract Outlook Body to Excel/Word

craignet

New Member
Joined
Aug 4, 2012
Messages
11
Hi all, would appreciate some help in creating a macro to do the below.

I have an online form sending CV information to an Outlook (2007) mailbox, I need to extract the data and create a personalised CV from a template I have been given. Ideally this would be in MS Word (2007).

I've seen various post's about extracting Outlook body data into an Excel workbook but am unable to find one explaining how to do this to word, so have thought to write an Excel macro to extract into a workbook and at the end of the macro copy the data into Word.

Below is an example of what the email body will look like, there are dynamic fields ie there could be more or less education/qualifications/jobs etc.. so I'm imagining this is going to be quite difficult to code.

I have intermediate an knowledge of VBA, but any advise is much appreciated as a little stuck on where to start with this.

Email Body

From: test@hotmail.co.uk
Sent: 23 March 2015 15:51
To: Craig Test
Subject: CV Builder - Craig Test Mr

CV Builder


Personal Information
NAME
Craig Test Mr
EMAIL
craigtest@hotmail.co.uk
CONTACT TELEPHONE NO.
07894052255
ALTERNATIVE TELEPHONE NO.
01234567898
ADDRESS
1 Test Court, Test Way, Testover, TS10 5TJ, United Kingdom
I HAVE A VALID DRIVERS LICENSE
No
I OWN A CAR
No

Personal Statement
PERSONAL PROFILE
The text in this section is an example of where the personal profile should be written, it should include statements about yourself outlined in the guide.

There could be gaps in the text to show different paragraphs in this personal statement.
Key Skills

Sales
Leadership
Communication Skills
Organised
Proactive
Management
Business Development
Determined
Team Player
Motivated

Work Experience
Job 1
JOB TITLE
Assistant Director
ORGANISATION
Test Company 1
LOCATION
Testover
START DATE
06/07/2009
END DATE (IF APPLICABLE)


Job 2
JOB TITLE
Test Manager
ORGANISATION
Testco
LOCATION
Testover
START DATE
06/11/2006
END DATE (IF APPLICABLE)
03/07/2009

Job 3
JOB TITLE
General Test
ORGANISATION
Little Test
LOCATION
Testparish
START DATE
31/03/2003
END DATE (IF APPLICABLE)
27/10/2006

Education & Qualifications
School / College/ University 1
SCHOOL/COLLEGE/UNIVERSITY NAME
Testbody
LOCATION
Testover
START DATE
01/02/2011
END DATE (IF APPLICABLE)
31/03/2011

Qualifications Achieved
Qualification 1
QUALIFICATION
Certificate of Test
GRADE ACHIEVED
Pass


School / College/ University 2
SCHOOL/COLLEGE/UNIVERSITY NAME
Test School
LOCATION
Testover
START DATE
15/09/1997
END DATE (IF APPLICABLE)
16/07/2002

Qualifications Achieved
Qualification 1
QUALIFICATION
Maths
GRADE ACHIEVED
A

Qualification 2
QUALIFICATION
Science
GRADE ACHIEVED
AA

Qualification 3
QUALIFICATION
English
GRADE ACHIEVED
AA

Qualification 4
QUALIFICATION
Graphic Design
GRADE ACHIEVED
A

Qualification 5
QUALIFICATION
French
GRADE ACHIEVED
A

Qualification 6
QUALIFICATION
Art
GRADE ACHIEVED
A

Qualification 7
QUALIFICATION
History
GRADE ACHIEVED
A

Qualification 8
QUALIFICATION
ICT
GRADE ACHIEVED
Pass


Hobbies & Interests
HOBBIES & INTERESTS
IT and Web Design, Science & Sci-Fi, Technology, Business, Microsoft Office & VBA, Arsenal FC, Politics, Music & Singing, Gastronomy

Was thinking at the end of the workbook to add something along the lines of:

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">[COLOR=#00008B]Sub[/COLOR][COLOR=#000000] ExportToWord_Example2[/COLOR][COLOR=#000000]()[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#00008B]Dim[/COLOR][COLOR=#000000] WordApp [/COLOR][COLOR=#00008B]As[/COLOR][COLOR=#000000] Word[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Application
    [/COLOR][COLOR=#00008B]Dim[/COLOR][COLOR=#000000] doc [/COLOR][COLOR=#00008B]As[/COLOR][COLOR=#000000] Word[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Document
    [/COLOR][COLOR=#00008B]Dim[/COLOR][COLOR=#000000] rng [/COLOR][COLOR=#00008B]As[/COLOR][COLOR=#000000] Range

    [/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] WordApp [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] CreateObject[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Word.Application"[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#00008B]With[/COLOR][COLOR=#000000] WordApp
        [/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Visible [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#800000]True[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] doc [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Documents[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Add
    [/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#00008B]With[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#00008B]For[/COLOR][COLOR=#00008B]Each[/COLOR][COLOR=#000000] rng [/COLOR][COLOR=#00008B]In[/COLOR][COLOR=#000000] ActiveSheet[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]UsedRange
        [/COLOR][COLOR=#00008B]With[/COLOR][COLOR=#000000] doc[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Paragraphs[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]doc[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Paragraphs[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Count[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range
            [/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Text [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] rng[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Text
            [/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Font[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Bold [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] rng[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Font[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Bold
            [/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Font[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Color [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] rng[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Font[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Color
        [/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#00008B]With[/COLOR][COLOR=#000000]
        doc[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]InsertParagraphAfter
    [/COLOR][COLOR=#00008B]Next[/COLOR][COLOR=#000000] rng
[/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#00008B]Sub[/COLOR]</code>

Any help/advice is greatly apriciated, or if anyone knows of any software which could potentially do something similar please let me know and I will look into.

Kind Regards

Craig
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,214,561
Messages
6,120,225
Members
448,951
Latest member
jennlynn

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