Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / May 2008

Tip: Looking for answers? Try searching our database.

mail merge with a word database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kim K - 07 May 2008 20:12 GMT
I have 2 word docs given to me to merge.  One is a form letter, the other the
"database".  THe form letter needs to have 3 fields.  Field one needs to pull
the info from the database of name of business, address, city, state, zip -
FIeld 2 needs ot pull the name and title of the program director, foeld three
needs to have a list of the employees and their title.  All this info is on
seperate pages in teh word database.  

How do I set up the necessary fields to populate the corerct info into the
proper places?  I ahve only done this with excel but never word, so input is
appreciated.
Signature

Thanks,,
Kim

Doug Robbins - Word MVP - 07 May 2008 20:46 GMT
It is not so much an issue of how you set up the necessary fields as one of
the manipulation that will be required of the data to get it into a format
that it is suitable for use as a mail merge data source.

If there is consistency in the way the data is arranged on each page, it
should be possible to create a macro that will manipulate that data into an
acceptable format, but we would need to know exactly how it is arranged to
be able to make suggestions for the code for such a macro.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I have 2 word docs given to me to merge.  One is a form letter, the other
>the
[quoted text clipped - 12 lines]
> is
> appreciated.
Kim K - 07 May 2008 21:53 GMT
Thank for your help, unfortunately I am not even getting paid for this!  

To answer your question, the database form is consistant, it starts with the
name and address of the business, followed by name and title followed by a
bulleted list of employees.  This is all on one page per business (all 97 of
them) - what type of macro would I need to do this?
Signature

Thanks,,
Kim

> It is not so much an issue of how you set up the necessary fields as one of
> the manipulation that will be required of the data to get it into a format
[quoted text clipped - 21 lines]
> > is
> > appreciated.
Doug Robbins - Word MVP - 08 May 2008 00:31 GMT
You would need to post into a message exactly how the information is
arranged, using an ¶ (Alt+0182 on the numeric keypad) where each of those
symbols is displayed when you toggle the Show Hide button in Word (that's
the button with the ¶ on it.  You would also need to show where any tab
spaces are include in the data - do that by including [tab] wherever one
occurs.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Thank for your help, unfortunately I am not even getting paid for this!
>
[quoted text clipped - 39 lines]
>> > is
>> > appreciated.
Kim K - 08 May 2008 01:46 GMT
Lets hope I get this right:

Name of business¶
Address¶
City, ST Zip¶
                *Name, Position¶
                *Name, Position¶
Name, Director¶

The first three lines will be merged onto the top of the letter
The Name/Positions will be merged into a numbered field in the letter
The Name,Director will be merged into the end of the letter

The indented positions are numerous, some business have 20-25 whiole others
have 3-4, and are set at 1 in margins.

Thank you!

Signature

Thanks,,
Kim

> You would need to post into a message exactly how the information is
> arranged, using an ¶ (Alt+0182 on the numeric keypad) where each of those
[quoted text clipped - 46 lines]
> >> > is
> >> > appreciated.
Doug Robbins - Word MVP - 08 May 2008 06:57 GMT
IF the layout of each page is as you indicate, if you run a macro containing
the following code when that document is the active document, it will creata
a new document with a table in it that contains the data in a format that
can be used as the data source for your mail merge operation.

Dim Source As Document
Dim Target As Document
Dim TTab As Table
Dim TRow As Row
Dim datarng As Range
Dim i As Long, Pages As Long
Set Source = ActiveDocument
Pages = Source.BuiltInDocumentProperties(wdPropertyPages)
Set Target = Documents.Add
Set TTab = Target.Tables.Add(Target.Range, 1, 5) TTab.Cell(1, 1).Range.Text
= "Company"
TTab.Cell(1, 2).Range.Text = "Address"
TTab.Cell(1, 3).Range.Text = "CityStZip"
TTab.Cell(1, 4).Range.Text = "Employees"
TTab.Cell(1, 5).Range.Text = "Director"
For i = 1 To Pages
   Set TRow = TTab.Rows.Add
   With Source
       TRow.Cells(1).Range.Text = .Paragraphs(1).Range.Text
       TRow.Cells(2).Range.Text = .Paragraphs(2).Range.Text
       TRow.Cells(3).Range.Text = .Paragraphs(3).Range.Text
       .Activate
       Selection.HomeKey wdStory
       Set datarng = .Bookmarks("\page").Range
   End With
   With datarng
       .Start = .Paragraphs(4).Range.Start
       .End = .Paragraphs(.Paragraphs.Count - 1).Range.End
       TRow.Cells(4).Range.Text = .Text
       .MoveEnd wdParagraph, 1
       .Start = .Paragraphs(.Paragraphs.Count).Range.Start
       TRow.Cells(5).Range.Text = .Text
   End With
   Source.Bookmarks("\page").Range.Delete
Next i
Source.Close wdDoNotSaveChanges
Target.Activate

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Lets hope I get this right:
>
[quoted text clipped - 77 lines]
>> >> > is
>> >> > appreciated.
Kim K - 08 May 2008 12:49 GMT
"Thank you, I have tried to run this but get a syntax error on this line:

Set TTab = Target.Tables.Add(Target.Range, 1, 5) TTab.Cell(1, 1).Range.Text
= "Company

Any ideas?
Signature

Thanks,,
Kim

> IF the layout of each page is as you indicate, if you run a macro containing
> the following code when that document is the active document, it will creata
[quoted text clipped - 120 lines]
> >> >> > is
> >> >> > appreciated.
Graham Mayor - 08 May 2008 15:41 GMT
That should be two lines and there should be a closing quote

Set TTab = Target.Tables.Add(Target.Range, 1, 5)
TTab.Cell(1, 1).Range.Text = "Company"

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> "Thank you, I have tried to run this but get a syntax error on this
> line:
[quoted text clipped - 164 lines]
>>>>>>> Thanks,,
>>>>>>> Kim
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.