Re: Match fields in Address block
From: Peter Jamieson (pjj_at_KillmapSpjjnet.demon.co.uk)
Date: 02/24/04
- Next message: Peter Jamieson: "Re: MailMerge vs. Catalog"
- Previous message: Peter Jamieson: "Re: How to refresh auto-numbering fields"
- In reply to: Bob S: "Re: Match fields in Address block"
- Next in thread: Bob S: "Re: Match fields in Address block"
- Reply: Bob S: "Re: Match fields in Address block"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Feb 2004 11:40:53 -0000
The problem here is, IMO, that when you initiate your merge from Outlook,
Outlook
a. creates a Word document and exports its data to that document
b. (re)specifies that document as the data source for the merge.
If you do not specify a data source document name in OL, OL will create a
new "temp" file, and connect to that. But even if you specify a "permanent"
Word document as the place to put the data, Outlook still does (b), and the
problem with that is that Word then discards - as far as I can tell -
c. any sort or filter coditions you may have specified in Word (OK, not too
important since you can filter in OL)
d. any "match fields" stuff you have set up.
In addition, in Word 2003, you also get a stream of questions about SQL
security, overwriting the existing data source etc. You might also get
questions about the data source not existing if
What's more, because Outlook opens the file /then/ does a reconnection job,
as far as I can see, writing an AutoOpen macro in your document would not
help because it would be executed too early in the process and its effects
would be overridden by Outlook's actions.
So I suspect that in order to restore the "Match fields" you need easily,
you would have to write a small macro to do it and attach it to a toolbar
button. Unfortunately Word does not seem to record Match fields operations,
and the code is slightly more tortuous than I would like, but e.g.
Sub MapPostalCode()
Dim oMDF As MappedDataField
With ActveDocument.MailMerge.DataSource
For Each oMDF In .MappedDataFields
If oMDF.Name = "Postal Code" Then
oMDF.DataFieldIndex = .DataFields("ZIPPostal_Code").Index
End If
Next
End With
End Sub
For a slightly more automated solution I suppose you could put the above
code inside the appropriate Mailmerge Event, but I haven't tried it and
since it's more complicated please ask if you need more info. on how to do
it.
As far as recording macros is concerned, although you can write VBA macros
for OL, OL has no facilty for recoording them. I am reasonably sure that it
would be possible to write an Outlook macro to do what you wanted but it's
non-trivial and I don't have suitable code on offer.
-- Peter Jamieson - Word MVP Word MVP web site http://word.mvps.org/ "Bob S" <BobS@nospam.com> wrote in message news:evMxHfc#DHA.3176@TK2MSFTNGP11.phx.gbl... > I would like to ask 2 more related questions Graham, if you do not mind. > 1. When I do a mail-merge (for labels) from OL, I use an existing document > for the document file. If I open that existing file within Word directly, > and then check the field matching, I find that all of the fields are > matched. If I go on with a mail merge either from a start in OL or a start > in MS Word, it is then that I find that the zip/postal code is NO LONGER > matched. Does that give any clue as to where the problem is? > > 2. If one starts the mail merge from OL (as you suggest), is it possible to > record a macro to do the task? > > Thank you for your help. > > "Graham Mayor" <gmayor@mvps.org> wrote in message > news:eAcj32Q%23DHA.3436@tk2msftngp13.phx.gbl... > > Bob S wrote: > > > Graham, > > > I read your other web page and also the one by Suzanne Barnhill that > > > you reference on your page. I also added the buttons on the merge > > > toolbar that both of you recommended. Unfortunately they did not > > > help my problems. > > > > > > Revised questions: > > > 1. Concerning Matched Fields holding, I am using the new Unicode > > > format for my OL pst file. Could that be the problem? > > > > That's what I use too - so this is not the problem. > > > > > 2. Two of my addresses seem almost identical, with 2 lines in the > > > street address and the other fields (city, state, zip, & country) all > > > filled. Yet one has a blank line between the third and fourth line. > > > Any thoughts? > > > > The address with the blank line either has an empty field or has a line > feed > > in a required field. You can insert a conditional field to correct for the > > former, but the latter will require the record to be edited. > > > > {IF {Mergefield Fieldname1} <> "" "{Mergefield Fieldname1} > > "{IF {Mergefield Fieldname2} <> "" "{Mergefield Fieldname2} > > " etc > > > > The above demonstrates the use of conditional field to insert the data > *and > > the following line feed* only when the field is not empty > > If you use the merge toolbar tools to insert exactly the fields you want > as > > described in the web page, the field matching issue should not cause a > > problem. > > > > > > -- > > <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > Graham Mayor - Word MVP > > E-mail gmayor@mvps.org > > Web site www.gmayor.com > > Word MVP web site www.mvps.org/word > > <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > > > -- > > <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > Graham Mayor - Word MVP > > E-mail gmayor@mvps.org > > Web site www.gmayor.com > > Word MVP web site www.mvps.org/word > > <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > > > > > > > "Graham Mayor" <gmayor@mvps.org> wrote in message > > > news:%23skomkE%23DHA.1052@TK2MSFTNGP12.phx.gbl... > > >> I see what you mean, but I have not been able to reproduce the > > >> problem here. The matched field holds. > > >> See if my other web page on merges helps make things easier for you - > > >> http://www.gmayor.com/mail_merge_labels_with_word_xp.htm. Although > > >> it uses labels as an example (as these are the most complicated) the > > >> information is applicable to all types of merge. > > >> > > >> -- > > >> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > >> Graham Mayor - Word MVP > > >> E-mail gmayor@mvps.org > > >> Web site www.gmayor.com > > >> Word MVP web site www.mvps.org/word > > >> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > >> > > >> > > >> Bob S wrote: > > >>> Graham, I do not think I understand all that you are saying. > > >>> > > >>> I think I have reinserted the Postal Code field into the template > > >>> and saved it again. And still it does not keep the Postal Code > > >>> matched. Here are some particulars. > > >>> > > >>> I saved it as a regular file. Do I need to do something special to > > >>> save it as a template? > > >>> When I click the button to "Match Fields", it has always been > > >>> showing "Postal Code" under the "Required Information" Category in > > >>> the left column of the dialog box. However, while most of the > > >>> fields in the boxes on the right show a definite match, the Postal > > >>> Code box still says (not matched). Even after I change it to > > >>> Zip/Postal Code and > > >>> then save it and start over with an existing document. > > >>> > > >>> I would like to come back to the other question after I understand > > >>> you on this one. > > >>> > > >>> > > >>> "Graham Mayor" <gmayor@mvps.org> wrote in message > > >>> news:e2o4cP49DHA.632@TK2MSFTNGP12.phx.gbl... > > >>>> Reinsert the Post code field into the template and save the > > >>>> template again. The missing line is caused by missing field > > >>>> information in > > >>>> the address. You can insert the address using conditional fields to > > >>>> place the address lines and their associated line feeds eg > > >>>> > > >>>> {IF {Mergefield Company} <> "" "{Mergefield Company} > > >>>> "}put the next address field here using the same format as above. > > >>>> > > >>>> -- > > >>>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > >>>> Graham Mayor - Word MVP > > >>>> E-mail gmayor@mvps.org > > >>>> Web site www.gmayor.com > > >>>> Word MVP web site www.mvps.org/word > > >>>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > >>>> > > >>>> > > >>>> Bob S wrote: > > >>>>> Thanks Graham. I did get access to all of my fields for matching > > >>>>> by starting the merge in OL 2003. However, I have a couple of > > >>>>> further questions. > > >>>>> > > >>>>> 1. I ran it several times and each time, it kept all of the > > >>>>> fields matched EXCEPT postal code. Each time I had to manually > > >>>>> match it to "Zip/postal code" at the very bottom of the list of > > >>>>> fields to match. How can I get this to pernamently match? > > >>>>> > > >>>>> 2. I have 9 addresses that require 4 lines. 5 of them look nice. > > >>>>> The other 4 have a gap (empty line) between lines 3 and 4. What > > >>>>> can be done about this? > > >>>>> > > >>>>> Thanks for your help. > > >>>>> > > >>>>> > > >>>>> > > >>>>> "Graham Mayor" <gmayor@mvps.org> wrote in message > > >>>>> news:uEnrRbu9DHA.2044@TK2MSFTNGP10.phx.gbl... > > >>>>>> You need to start the merge from Outlook - see > > >>>>>> http://www.gmayor.com/mailmerge_from_outlook.htm > > >>>>>> > > >>>>>> -- > > >>>>>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > >>>>>> Graham Mayor - Word MVP > > >>>>>> E-mail gmayor@mvps.org > > >>>>>> Web site www.gmayor.com > > >>>>>> Word MVP web site www.mvps.org/word > > >>>>>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<> > > >>>>>> > > >>>>>> > > >>>>>> Bob S wrote: > > >>>>>>> I am using Office 2003 on XP Pro. > > >>>>>>> > > >>>>>>> I want to run a mail merge using an existing document. When I > > >>>>>>> get to Step 3 of 6 and click the match fields button, I see > > >>>>>>> them all matched up with a great number of fields to choose > > >>>>>>> from in the > > >>>>>>> pull down > > >>>>>>> lists. > > >>>>>>> > > >>>>>>> Unfortunately, when I select "select from Outlook contacts", > > >>>>>>> choose the contact folder, and press OK, I find that most of the > > >>>>>>> fields are NOT matched and that there are only a few options to > > >>>>>>> choose from - namely: Icon, File as, Company, Original Display > > >>>>>>> Name, Home phone, Home Address, Display Name, and (not matched). > > >>>>>>> > > >>>>>>> How do I get the other choices back? > > >>>>>>> > > >>>>>>> Thank you much for your help. > > > > > >
- Next message: Peter Jamieson: "Re: MailMerge vs. Catalog"
- Previous message: Peter Jamieson: "Re: How to refresh auto-numbering fields"
- In reply to: Bob S: "Re: Match fields in Address block"
- Next in thread: Bob S: "Re: Match fields in Address block"
- Reply: Bob S: "Re: Match fields in Address block"
- Messages sorted by: [ date ] [ thread ]