Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
a a is offline
external usenet poster
 
Posts: 2
Default Mail Merge And access 2003

Dear friends

I have a word template

Mytemp.dot

This is mail merge template connected to access.mdb

What I want:

(1) I want code to open the mytemp.dot (From Access 2003)

But not mytemp.dot itself

I want open a new word document based on mytemp.dot as like (merge to new
document) so the user can't edit the mytemp.dot

Again I want user open instance from mytemp.dot and the mytemp.dot connect
to mydatabase and merge to a new word document



(2) how can prevent user from change mytemp.dot it self can't copy or edit
the mytemp.dot content or save it (From word 2003)

Is this possible


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail Merge And access 2003

In the VBA editor, use Tools-References to make a reference to the
relevant Word object then use e.g.

' MMMD is "Mail Merge Main Document"
Dim objMMMD As Word.Document
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
Set objMMMD = objWord.Documents.Add("the full pathname of mytemp.dot")

You should add error checking code, of course

If the template is already connected to the correct data source, the new
document based on it should also be connected, unless there is a problem
with multi-user access in which case this approach will not work. It is
probably better to ensure that the template is /not/ connected to the
data source, and make the connection in code, e.g. if you are using
Access VBA, try

objMMMD.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
SQLStatement:="SELECT * FROM mytable"

However,
a. you will need to provide your own query code
b. that will only work with some types of database and e.g. if you
have a workgroups security database you will need more.

The basic code to merge to a new document is

objMMMD.MailMerge.Destination = wdSendToNewDocument
objMMMD.MailMerge.Execute

You should be able to reference the new document using

objWord.ActiveDocument

You will need to close it, close objMMMD, then use objMMMD.Quit to close
the instance of Word created by CreateObject.

(2) how can prevent user from change mytemp.dot it self can't copy or

edit
the mytemp.dot content or save it (From word 2003)


The easiest way to prevent the user from modifying the template is
probably to make it read only in Windows for the relevant users.

Peter Jamieson

http://tips.pjmsn.me.uk

a wrote:
Dear friends

I have a word template

Mytemp.dot

This is mail merge template connected to access.mdb

What I want:

(1) I want code to open the mytemp.dot (From Access 2003)

But not mytemp.dot itself

I want open a new word document based on mytemp.dot as like (merge to new
document) so the user can't edit the mytemp.dot

Again I want user open instance from mytemp.dot and the mytemp.dot connect
to mydatabase and merge to a new word document



(2) how can prevent user from change mytemp.dot it self can't copy or edit
the mytemp.dot content or save it (From word 2003)

Is this possible


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 from Access 2003 to Word 2003 KarenMike Mailmerge 2 April 2nd 08 04:19 PM
Word 2003 and Access 2003 mail merge current record display issue JohnMed Mailmerge 1 January 30th 08 06:57 PM
Automating Mail merge between Word 2003 and Access 2003 using VB.NET [email protected] Mailmerge 5 October 17th 06 11:25 PM
Mail merge to a query in Access 2003 Jet Black Mailmerge 1 October 4th 05 07:40 PM
Word 2003 and Access 2003 Mail Merge question HD87glide Microsoft Word Help 2 December 15th 04 02:29 PM


All times are GMT +1. The time now is 04:47 PM.

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"