Re: next-record-if else STOP?
From: Doug Robbins (dkr_at_NOmvpsSPAM.org)
Date: 11/14/04
- Next message: suew1231: "Mail merge from one data soure to a number of different main doc?"
- Previous message: Doug Robbins: "Re: multi page merge"
- In reply to: David Rothman: "Re: next-record-if else STOP?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 13 Nov 2004 19:04:55 -0500
Hi David,
I don't know of one floating around that does exactly what you want, but
using some of the ideas/methods in what I previously posted and some of the
techniques in the article "Mail Merge to E-mail with Attachments" at
http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm
you should be able to achieve it.
-- Please respond to the Newsgroup for the benefit of others who may be interested. Questions sent directly to me will only be answered on a paid consulting basis. Hope this helps, Doug Robbins - Word MVP "David Rothman" <drothman@optonline.net> wrote in message news:uz8LY9ZyEHA.2600@TK2MSFTNGP09.phx.gbl... > doug, i don't think i was clear... > > the RESULT of my mail merge (using 294686) was something like: > > City:Houston > email:h@houston.com > > record1 > record2 > record3 > > City: Atlanta > email:a@atlanta.com > > record1 > > City:NY > email:n@ny.com > > record1 > record2 > record3 > record4 > > > > some of the lists had 50-100 records (thus if paged, they would run to > more > than one page). > > my 'simple' task now is to strip out Atlanta's records and email to > a@atlanta.com > and similarly to every city. > > i could use a word keystroke macro to do most of it (search on "City:" cut > that section out of the main doc and paste to a new doc, but when i get to > emailing, the macro stops (as you're no longer in Word's domain, but in > your > email client's), but i can't automate the whole process. > > i was hoping there's a macro floating around that could parse a Word file > into sections and email them according to some email address field per > section. thanks for any ideas. > > > > > > "Doug Robbins" <dkr@NOmvpsSPAM.org> wrote in message > news:uCsdaCYyEHA.3908@TK2MSFTNGP12.phx.gbl... >> Word does not really have the ability to perform a "multiple items per >> condition (=key field)" mailmerge. >> >> See the "Multiple items per condition" item under the "Special merges" >> section of fellow MVP CIndy Meister's website at >> >> http://homepage.swissonline.ch/cindymeister/MergFram.htm >> >> Or, if you create a Catalog (on in Word XP and later, it's called > Directory) >> type mailmerge main document with the mergefields in the cells of a one > row >> table in the mailmerge main document with the keyfield in the first cell > in >> the row and then execute that merge to a new document and then run the >> following macro, it will create separate tables with the records for each >> key field in them. With a bit of further development, you may be able to >> get it to do what you want - like put each of those tables in a separate >> document and email them. >> >> See the article "Mail Merge to E-mail with Attachments" at >> >> http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm >> >> ' Macro to create multiple items per condition in separate tables from a >> directory type mailmerge >> >> Dim source As Document, target As Document, scat As Range, tcat As Range >> Dim data As Range, stab As Table, ttab As Table >> Dim i As Long, j As Long, k As Long, n As Long >> Set source = ActiveDocument >> Set target = Documents.Add >> Set stab = source.Tables(1) >> k = stab.Columns.Count >> Set ttab = target.Tables.Add(Range:=Selection.Range, numrows:=1, >> numcolumns:=k - 1) >> Set scat = stab.Cell(1, 1).Range >> scat.End = scat.End - 1 >> ttab.Cell(1, 1).Range = scat >> j = ttab.Rows.Count >> For i = 1 To stab.Rows.Count >> Set tcat = ttab.Cell(j, 1).Range >> tcat.End = tcat.End - 1 >> Set scat = stab.Cell(i, 1).Range >> scat.End = scat.End - 1 >> If scat <> tcat Then >> ttab.Rows.Add >> j = ttab.Rows.Count >> ttab.Cell(j, 1).Range = scat >> ttab.Cell(j, 1).Range.Paragraphs(1).PageBreakBefore = True >> ttab.Rows.Add >> ttab.Cell(j + 1, 1).Range.Paragraphs(1).PageBreakBefore = False >> For n = 2 To k >> Set data = stab.Cell(i, n).Range >> data.End = data.End - 1 >> ttab.Cell(ttab.Rows.Count, n - 1).Range = data >> Next n >> Else >> ttab.Rows.Add >> For n = 2 To k >> Set data = stab.Cell(i, n).Range >> data.End = data.End - 1 >> ttab.Cell(ttab.Rows.Count, n - 1).Range = data >> Next n >> End If >> Next i >> >> >> -- >> Please respond to the Newsgroup for the benefit of others who may be >> interested. Questions sent directly to me will only be answered on a > paid >> consulting basis. >> >> Hope this helps, >> Doug Robbins - Word MVP >> "David Rothman" <drothman@optonline.net> wrote in message >> news:%23yL4mtMyEHA.924@TK2MSFTNGP10.phx.gbl... >> > ok..great thanks..that works... >> > >> > now (:-) )... >> > >> > using the 294686 analogy, i now have a document with a Heading ("City") >> > and >> > a bunch of data points under it and that repeats, ala: >> > >> > Houston >> > record1 >> > record2 >> > record3 >> > >> > Atlanta >> > record1 >> > >> > NY >> > record1 >> > record2 >> > record3 >> > record4 >> > etc etc >> > >> > >> > i can put delimeters before each city name (ie. City: Houston). >> > >> > i could even put a section or page break. >> > >> > but, is there a relatively simple way to send an email to the email >> > address >> > associated with each city where it would contain (just) that city's > data? >> > >> > or worst case, is there a simple Word file splitter around that could >> > split >> > the word file into named (i..e Atlanta.doc) files so that i could > manually >> > email them? thanks again >> > >> > >> > >> > "Cindy M -WordMVP-" <C.Meister-C@hispeed.ch> wrote in message >> > news:VA.0000a254.00766e5c@speedy... >> >> Hi David, >> >> >> >> > what i don't understand in 294686 is why i'm getting page breaks >> >> > between >> >> > each line of output. the example in the KB indicates just >> >> > linefeeds, >> > yet i >> >> > can't get rid of the section (page breaks). >> >> > >> >> Are you choosing a catalog (directory) type of mail merge? That's the >> >> only >> >> one that doesn't insert a next page section break after each record. >> >> >> >> Cindy Meister >> >> INTER-Solutions, Switzerland >> >> http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) >> >> http://www.word.mvps.org >> >> >> >> This reply is posted in the Newsgroup; please post any follow question > or >> >> reply in the newsgroup and not by e-mail :-) >> >> >> > >> > >> >> > >
- Next message: suew1231: "Mail merge from one data soure to a number of different main doc?"
- Previous message: Doug Robbins: "Re: multi page merge"
- In reply to: David Rothman: "Re: next-record-if else STOP?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|