Is there anyway of extracting lines out of an email in Outlook, and importing them into the relevant boxes in a Word doc (which has already been created as a form)?
e.g:
The Email looks a little like:
Learning Grant Application Form
Your company name: LEARN.org.uk ltd
Your name: Zaheer Laher
Your position in the company: Company Secretary - Chair
The Word doc looks a little like:
Company Name: box1
Client: box2
Job Title: box3
Could this Word doc be set up as a template like when you do a mail merge?? If so how??
I've created this VBScript file which scans a chosen Mailbox and folder for messages addressed to me. It could be easily pasted into VBA should you require. The settings are specified in the .ini which must have the same name as the application and exist in the same folder.
You can use the code here to open an email (just take out the .Display if you want it to be hidden from the user) and then you can read from the email by setting .body to a string.
OK. njwilli didn't mention that s/he wanted to specifically perform a mail merge - just that s/he wanted to pull lines out of an email and push them into a Microsoft Word form.
The way i would do this is search for the relevent email, read the email in line by line and push the required data in to the relevant form fields.
Ya, thats the problem. To search in Outlook from Word would bring up the Security prompt. Not to mention that it will be slow
if it involves allot of emails. You might have better performance using DAO or ADO to retrieve a recordset of emails and that
could be used as the DataSource for a mailmerge in Word.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.