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
--
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
Kim K said:
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!
--
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 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.
--
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!
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?
--
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
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.
--
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
"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.