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 2004

Tip: Looking for answers? Try searching our database.

changing the mailmerge source file at startup

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeremy - 21 Apr 2004 12:11 GMT
I have a word document that uses a merge file in the c:\ root
directory ( I inherrited this) which is put there by another app.

and now I need to run this via terminal server. so if two people
create this file, chaos will ensue.

so I was thinking of putting this file into the %userprofile%
directory

however, word likes to know the name of this file in advance. I have
tried a macro to change the
activedocument.mailmerge.datasource.querystring but this doesn't work.
does anybody have a better solution?

thanks in advance.
Cindy M  -WordMVP- - 21 Apr 2004 16:30 GMT
Hi Jeremy,

The usual approach would be to save the document without a link to the
data source, then just link up the data on open. If you tell us which
version of Word you'd use to edit the document, we can give you more
detailed pointers :-)

> I have a word document that uses a merge file in the c:\ root
> directory ( I inherrited this) which is put there by another app.
[quoted text clipped - 9 lines]
> activedocument.mailmerge.datasource.querystring but this doesn't work.
> does anybody have a better solution?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
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 :-)
Jeremy - 22 Apr 2004 10:01 GMT
> Hi Jeremy,
>
[quoted text clipped - 24 lines]
> This reply is posted in the Newsgroup; please post any follow question
> or reply in the newsgroup and not by e-mail :-)

we are using office xp and win2000, hope that is enough info

Jeremy
Doug Robbins - Word MVP - 22 Apr 2004 10:39 GMT
Hi Jeremy,

In the mailmerge main document, open the Mailmerge Helper and in Section 1
of the Helper, click on Create and select Restore to Normal Word Document.
While the mailmerge fields will be retained in the document, the link to the
datasource will be removed.

Signature

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

> > Hi Jeremy,
> >
[quoted text clipped - 28 lines]
>
> Jeremy
Cindy M  -WordMVP- - 22 Apr 2004 17:59 GMT
Hi Jeremy,

Further to Doug's response:

Then use the macro recorder to record linking up to the data source, in
order to get the syntax you need. Alter the code, adding a variable where
you can store the user profile location. Substitute this everywhere in the
OpenDataSource method where the file path to the data source appears. Name
the macro AutoOpen so that it will execute when the user opens the document,
and make sure it's saved IN the document (and not in your Normal.dot).

If you're really using a template, and the users should create a new
document from the template, then name the macro AutoNew and save it IN the
template. If users are likely to need such a document at the same time, you
will need to use a template.

> > The usual approach would be to save the document without a link to the
> > data source, then just link up the data on open. If you tell us which
[quoted text clipped - 14 lines]
> > > activedocument.mailmerge.datasource.querystring but this doesn't work.
> > > does anybody have a better solution?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
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 :-)
Jeremy - 23 Apr 2004 10:37 GMT
That all works fine!

I removed the original file (in the c:\ directory) open the document,
where word complained that the mail merge source was missing, if you
click the options button, you have the oportunity to remove all mail
merge information.

then some code in the autoopen macro of the document (not normal.dot)
you can create it if it isn't there pointed the mail merge to the
right place

   Dim userprofile As String

   userprofile = Environ("userprofile")
   ActiveDocument.MailMerge.OpenDataSource Name:=userprofile +
"\<merge_file>"

Thanks for all the help

Jeremy

> Hi Jeremy,
>
[quoted text clipped - 38 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
Cindy M  -WordMVP- - 23 Apr 2004 16:11 GMT
Hi Jeremy,

> That all works fine!

Great :-)! Glad you're up and running.

   Cindy Meister
 
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.