Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-22-2012, 01:41 AM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default Mailmerge to Email with a mailmerge attachment

I have 2 mailmerge documents both of which draw there information from a query in my Charity's Access database.



The first document is set up as an email and I have no trouble getting the various emails to be sent (using the Finish & Merge facility on the Mailings tab).

But the second document is a Word form and I want this to be attached to each of the emails (linked obviously to the same person's details). How can I do this? There doesn't seem to be any obvious way to do this!

Any help would be much appreciated.
Reply With Quote
  #2  
Old 05-22-2012, 02:55 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,294
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

See: http://word.mvps.org/FAQs/MailMerge/...ttachments.htm
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 05-24-2012, 03:22 AM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default

Thanks for pointing me to the MVP document. I am working through this but am having a bit of a struggle!
I have created a Directory document called Test Email Mailmerge.docx (see attached). This is linked to my source data (which is a query in MS Access). Attachment1 is a Word document (created as an email) which is also linked to the same data source. Attachment2 is also a Word document (created as a Form for completion by the recipient) and is also linked to the same data source.
My intention had been that I wanted Attachment1 to be emailed to those in my data source with Attachment2 attached to that email.
But by following the MVP document I have a couple of problems -
1. In the example, it shows that when the Directory is merged Attachment1 & Attachment2 are showing information related to the person in the relevant email address. How does that happen if the path is simply to a file? Even though that file is a mailmerge document? My attachments are simply showing the path to the main mailmerge documents.
2. What file are you supposed to attach the VB macro to? Is it to the original Directory document, or to the document created by merging the Directory document or to the first of my attachments?
3. When I did get the macro to run it came up with 2 errors. At both
Dim oOutlookApp As Outlook.Application and Dim oItem As Outlook.MailItem
it says there is a 'Compile Error - User Defined type not defined'. I tried by eliminating both these lines but, although the macro seemed to run (it asked me for a title for the email) at the end it said no emails had been sent (when there should have been 3). I am not proficient in VB so I am struggling here.

Can you please help me a bit more on the above? Should I be using my Attachment1 as the main email or am I right to have both my files as attachments?
I look forward to hearing from you again.
Reply With Quote
  #4  
Old 05-24-2012, 03:26 AM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default

The file that I intended to attach is here now.Test EMail Mailmerge.docx
Reply With Quote
  #5  
Old 05-24-2012, 06:10 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,294
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

The mailmerge process envisaged in the link entails two mailmerges:
• a directory merge from your Access DB
• an email merge from the Word file generated by the directory merge.
I don't know what your Attachment1 & Attachment2 have in them, but they can't be connected to your Access DB when they are merged. It sounds rather like you need to generate the merges of these two documents, then split them into individual letters that the directory merge's table references so that the email merge can find and attach them.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #6  
Old 05-25-2012, 02:36 AM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default

Thanks for your further guidance. I think I am understanding a little bit better whats going on!
I have got my master mailmerge directory document with the 3 test email addresses but I am still having a problem understanding how I can get my 2 attachments to identify with each individual. As I explained earlier, my original 2 attachments drew their data from the same query in Access. The fields in both included names & addresses & donor numbers (as well as the email addresses). But if, as you suggest, I need to split the results of the merging of these 2 documents into individual letters(emails) and forms I have a problem! When I complete the merges the results of each are in one single file. Can you guide me as to how these can be split into individual letters(emails) & forms (identified by the email address) and how can they then be linked (via the email address) to the email address in the master directory file?
I get the impression that what you have suggested is likely to solve my problem - if only I could actually apply it to my files!
Reply With Quote
  #7  
Old 05-25-2012, 04:46 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,294
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

For a add-in & macro to create the individual attachments, see: http://www.gmayor.com/individual_merge_letters.htm
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #8  
Old 05-26-2012, 12:51 PM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default

I have managed to get emails to be sent with my email taxt in the body of the email and my form attached as an attachment!! Just a couple of presentational points that I will return to on Monday -
1. In my email document I have a number of hyperlinks to our website but these are not carried through to the individual emails.
2. In my form (attachment) I have 3 address fields in a single line separated by spaces and a Postcode on a line of its own. On the first of the 3 emails to be dispatched everything is OK but on the 2nd and 3rd emails each of these fields is truncated, only the first 3 figures or letters of each are displayed.
Any thoughts on either of these points?
Reply With Quote
  #9  
Old 05-26-2012, 08:14 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,294
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi Baldeagle,

If the hyperlink links are:
• in one of the mailmerge main documents, simply convert them to hyperlinks there before executing the mailmerge.
• added via the mailmerge, you need to embed them in a hyperlink filed. However, by default, if you insert a mailmerge field into a hyperlink field, the hyperlinks will all show the first record’s address as the 'Text to display' text. Here's how you can do get a mailmerge to display your preferred default 'Text to display' text instead:
1. Disregarding mergefield issues for the moment, insert a hyperlink into the document in the normal way, choosing whatever 'Click Here' text you want in the 'Text to display' box.
2. Select the inserted hyperlink and press Shift-F9 to expose its field code.
3. Replace everything in the field after 'HYPERLINK' with your mergefield.
4. Select the field and press F9 to update the display.

In Word 2007 & later, you can make the display text variable also, by following these additional steps:
5. Position the cursor anywhere within the display text.
6. Insert a mergefield pointing to whatever data field you want to use for the display text (this could even be the same field as used at step 3 above).
7. Delete all of the previous display text either side of your last-inserted mergefield (note that this field will likely have updated already).
8. Execute the merge.
9. After merging to a new document, use Ctrl-A, F9 to update all fields. Without this, the mergefield hover text won’t update to the correct targets.

As for the truncated addresses, that suggests a problem with your data layout. Without seeing an example, it's hard to diagnose.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #10  
Old 05-28-2012, 02:56 AM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default

Thanks for your further guidance.
On the hyperlink point - my hyperlinks are in the mailmerge main document for my email messages. When I merge them within Word the hyperlinks are still there. But when I merge to send them as emails (with attachments) the hyperlinks revert to plain text. See July Gift Aid email - Test.docx.

On the truncated addresses point I have uploaded my master form 'Allocations form for Gift Aid & Tax Refund (Form) (Mailmerge) - Test (Copy).docx', the first and second merged attachments 'Form 1.docx' and 'Form 2.docx'. From these can you work out what is going wrong?

One other, hopefully final, question. Is it possible to format the amount columns on the Forms as currency? At present when data is entered it simply appears as numeric. I would prefer if '20' was entered it would appear as '20.00'.

Thanks again for your patience - but a lot of progress has been made.
Attached Files
File Type: docx Allocations form for Gift Aid & Tax Refund (Form) (Mailmerge) - Test (Copy).docx (55.0 KB, 2 views)
File Type: docx July Gift Aid email - Test.docx (15.7 KB, 3 views)
File Type: docx Form 1.docx (46.1 KB, 4 views)
File Type: docx Form 2.docx (46.2 KB, 3 views)
Reply With Quote
  #11  
Old 05-28-2012, 07:37 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,294
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi Baldeagle,

I can't see anything in the files that would account for data truncation. Perhaps you should re-check the data source - it may be incomplete or corrupt. What happens if you do, say, a directory or label merge for all records? Do they still get truncated?

As for the currency, simply add a numeric picture switch to the relevant fields. To do this:
• select the field;
• press Shift-F9 to reveal the field coding. It should look something like {MERGEFIELD MyData};
• edit the field so that you get {MERGEFIELD MyData \# ,0.00};
• position the cursor anywhere in this field and press F9 to update it;
• run your mailmerge.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #12  
Old 05-29-2012, 01:39 AM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default

Thanks again, Paul.

The truncated addresses problem was my fault! As it was only a test I had not filled the table in Access with the complete information! Sorry.

As far as the currency issue is concerned, the cells in the form are not filled with merged data, the idea is that the recipient of the form will enter figures and send the form back to the Treasurer. When I select the cell and press Shift - F9 nothing happens. Is there some other way to make these cells appear as currency when someone enters a figure?

Any more thoughts on the hyperlink problem?
Reply With Quote
  #13  
Old 05-29-2012, 02:45 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,294
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi Baldeagle,

The stuff re Shift-F9 applies to fields, but it seems you want to apply the format to table cells without fields. Word doesn't have that kind of automatic formatting for tables. It can do it automatically with formfields, but adding kind of functionality would require a lot more processing (you can't have the required formfields in a mailmerge main document) to add the formfields after the mailmerge is done.

I note also that you have content controls in the 'Allocations' document. You need to be aware that, for users of earlier versions of Word: (a) they may be unable to open docx files (Word 2003 & earlier can only open such files if the MS converter has been installed); and (b) even if they can, the content controls will be deleted but the 'Enter Amount' text will remain and have to be deleted before an amount can be input.

As for the hyperlinks, if you're using an addin from the link I provided, it may be that the code it uses a command like '.Fields.Unlink' as part of its processing. That would clobber the hyperlinks.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #14  
Old 05-29-2012, 02:04 PM
Baldeagle Baldeagle is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Apr 2012
Posts: 59
Baldeagle is on a distinguished road
Default

Thanks again, Paul. After a good bit of work today I think I can say that my problems have been solved sufficiently to let me have something that is useable!

As far as the hyperlink problem is concerned there was no sign of '.Fields.Unlink' in the code. But I have treated my email as an attachment (and have simply used a short one line email to refer to the 2 attachments). When the attachment is opened it has the hyperlinks OK.

As regards the currency problem, I have decided that I will leave well-enough alone - if Word isn't up to what I was hoping for then I will have to be content without special formatting of the cells!

I take your point about not everyone being able to open a .docx file so I have converted the attachments to .doc files in order to avoid any problems.

My test now works to my satisfaction. July will bring the live running so I can look forward to that with a lot more confidence thanks to your patience and guidance. Many thanks.
Reply With Quote
Reply

Tags
attachment, email, mailmerge
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Email from MailMerge Baldeagle Mail Merge 4 04-06-2012 05:46 AM
Mailmerge dkub Mail Merge 35 12-07-2011 11:35 PM
How do you add text to email mailmerge? DerekScambler Mail Merge 10 04-19-2011 05:30 AM
Help with mailmerge??? foxtrot1981 Mail Merge 0 12-03-2010 08:21 AM
MailMerge fax not e-mail? JDCarb Mail Merge 3 04-02-2010 04:10 PM


All times are GMT -7. The time now is 06:16 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft