Reply
 
Thread Tools Display Modes
  #1   Report Post  
Jane
 
Posts: n/a
Default Insert excel data into word via mail merge

I want to print year end summaries to the employees who have stock sale tax
reported on their W2. The word doc. that will be sent out contains standard
data that these emp. will receive. However the numbers are in excel. How do
I merge this information into the doc. file in a way so that I don't have to
do it manually for 200 emp.
For eg:
Joe Smith
The attached file contains records of the income that has been reported on
your W2 pursuant to your sale of ESPP shares/options exercise.

Grt dt. Grt.type Ex. Dt Opt. ex. Opt. price FMV at ex Total gain
9/29/2002 Incentive 8/27/2004 3,125 $12.7054 $39,704.50
9/29/2002 Incentive 10/29/2003 520 $13.5990 $7,071.49 Total 48,203.34
Reported in W-2 48,203.34

I am using word 03 and excel 03
Hope this makes sense.
Thanks




  #2   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default

Mail merge in Word cannot really hand a multiple items (transactions in your
case) per condition (Employee in your case) situation.

If you have Microsoft Access, I would recommend transferring the data into
Access and then use an Access Report.

Otherwise, you could try further developing the following macro. It would
take some work, but it would be quite feasible to get it to do what you
want.

' Macro to create multiple items per condition 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.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
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 post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
"Jane" wrote in message
...
I want to print year end summaries to the employees who have stock sale

tax
reported on their W2. The word doc. that will be sent out contains

standard
data that these emp. will receive. However the numbers are in excel. How

do
I merge this information into the doc. file in a way so that I don't have

to
do it manually for 200 emp.
For eg:
Joe Smith
The attached file contains records of the income that has been reported on
your W2 pursuant to your sale of ESPP shares/options exercise.

Grt dt. Grt.type Ex. Dt Opt. ex. Opt. price FMV at ex Total gain
9/29/2002 Incentive 8/27/2004 3,125 $12.7054 $39,704.50
9/29/2002 Incentive 10/29/2003 520 $13.5990 $7,071.49 Total 48,203.34
Reported in W-2 48,203.34

I am using word 03 and excel 03
Hope this makes sense.
Thanks





Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Word 2003 Issue S.Nicks Mailmerge 5 February 20th 09 01:55 AM
Word Field Codes in Excel data file mranz Mailmerge 7 December 11th 04 09:02 AM
Word mail merge data loss Gibson Mailmerge 1 December 8th 04 01:30 PM
can I merge two sets of address data in Word Mail merge kenben Mailmerge 1 December 4th 04 04:01 PM
Mail merge error occurs when filtering Excel data source Dave Mailmerge 1 December 2nd 04 10:46 PM


All times are GMT +1. The time now is 07:47 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"