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 / April 2005

Tip: Looking for answers? Try searching our database.

Mail Merge and Project

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
debraholloway - 06 Apr 2005 17:07 GMT
Help.  I want to email using a mail merge.  The data is in microsoft project
server.  Each person should only get the rows of data that applies to them.  
If I were creating the report in Access I would use a "group by"

Can you do a  group by with a mail merge?  I am open to other suggestions.
Signature

Debra H.

Peter Jamieson - 06 Apr 2005 18:42 GMT
My memory of project server is pretty vague, but if it uses a SQL
Server/MSDE database it may be possible to create a View in the database
that does what you need. If so, I don't know whether there is a way to
specify a person's username in the view to give you the results you need,
but /a/ way of doing that within a SQL Server environment would be to create
a view for each user that did the right thing.

Otherwise, Word does not provide a way to specify a GROUP BY clause in its
user interface, but there are a number of ways that the user interface might
be bypassed,  e.g.
a. you may be able to create a suitable VIEW in the server and use that as
the data source (as above)
b. if your users happen to have Access installed, it may be possible to
link to your Project Server tables/queries from access, then create the
Access query/queries you need and use those as the data source.
c. you can use Word VBA's OpenDataSource method to connect to a data
source, issuing a short SQL query directly (either around 256 or 512
characters)
d. if you can connect to your data source using ODBC, you can set up an
ODBC DSN and use Microsoft Query to define a suitable query to get your
data.

However, all the above assumes that your merge is based on a table of
records with identical format, i.e. that the result of the SQL SELECT with a
GROUP BY clause is returning a "flat table" of rows. If what you actually
want to do is produce a more hierarchical type of output, where you use
GROUP BY to specify some heading info and a number of "child records", Word
is not designed to do that. Let us know.

Peter Jamieson

> Help.  I want to email using a mail merge.  The data is in microsoft
> project
[quoted text clipped - 3 lines]
>
> Can you do a  group by with a mail merge?  I am open to other suggestions.
debraholloway - 06 Apr 2005 18:55 GMT
I can export the data to excel, but then I still need to be able to merge all
the rows for a single project manager into an email, and then create the next
email for the next pm with only the information that applies for that project
manager.

I took a look at KB article 212375, but it's still a little unclear.

Can I email the view results from Access?

> My memory of project server is pretty vague, but if it uses a SQL
> Server/MSDE database it may be possible to create a View in the database
[quoted text clipped - 34 lines]
> >
> > Can you do a  group by with a mail merge?  I am open to other suggestions.
Peter Jamieson - 06 Apr 2005 19:22 GMT
> I took a look at KB article 212375, but it's still a little unclear.

Doug Robbins' nearby message may help if you need some form of parent-child
reporting using Word.

> Can I email the view results from Access?

I would be inclined to ask that question in an Access group. However, it
partly depends on the group you need to distribute to.
a. if you can print to the Microsoft Office Document Image Writer in Office
2003 (maybe 2002, I forget), then you should be able to distribute a .mdi or
perhaps multipage .tif
b. if you have the full pay-for version of Acrobat, you should be able to
print to a .pdf that could be distributed to anyone with a .pdf viewer
c. you may be able to distribute an Access "snapshot" that can be viewed
with the snapshot viewer. But that's wehre you really need those Access
people...

Peter Jamieson

>I can export the data to excel, but then I still need to be able to merge
>all
[quoted text clipped - 53 lines]
>> > Can you do a  group by with a mail merge?  I am open to other
>> > suggestions.
Doug Robbins - 06 Apr 2005 18:51 GMT
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.

' 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

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

> Help.  I want to email using a mail merge.  The data is in microsoft
> project
[quoted text clipped - 3 lines]
>
> Can you do a  group by with a mail merge?  I am open to other suggestions.
 
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.