Access97 and Word97 (MailMerge) 
Author Message
 Access97 and Word97 (MailMerge)

Hi all,

can anyone tell me how it can be done to programmatically change
the DataSource of a mailmerge-object?
I have the following problem:
I use Access97 to open a "Word.Application"-object,
The document that I open is a mailmerge document with a certain
DataSource,
but I want to be flexible to put my Database in any location I want.
Opening the document, merging and printing works well, but how
do I change the DataSource.Name, because this property is read-only??

Any help would be appreciated
thanks
GUENTER

  vcard.vcf
< 1K Download


Sat, 28 Oct 2000 03:00:00 GMT  
 Access97 and Word97 (MailMerge)

You can use the OpenDataSource method with the "Word.Application" object to
open a new datasource for your mailmerge-document.
I did not find a way to avoid opening the database twice if you run the code
from the database that is also the datasource for your mailmerge-document.
So, to avoid this, it could be a good idea to first export the
datasource-records to a separate RTF-document and use this document as your
datasource.



Sat, 28 Oct 2000 03:00:00 GMT  
 Access97 and Word97 (MailMerge)

You can try this !

My mailmerge function, based on MS KnowledgeBase
article Q159328, looks
like this:

public function MergeWord()
dim objWord as Word.Document

Set objWord = GetObject("MYMODEL.DOC",
"Word.Document")

objWord.Application.Visible = True

objWord.MailMerge.MainDocumentType = wdFormLetters
objWord.MailMerge.OpenDataSource
Name:=CurrentDb.Name, _
ReadOnly:=True, LinkToSource:=True,
_
Revert:=False, Connection:="QUERY
reqWord"

objWord.MailMerge.SuppressBlankLines = True
objWord.MailMerge.Destination =
wdSendToNewDocument
objWord.MailMerge.Execute
end function

Guenter Brandstaetter a crit dans le message

Quote:
>Hi all,

>can anyone tell me how it can be done to

programmatically change
Quote:
>the DataSource of a mailmerge-object?



Sat, 28 Oct 2000 03:00:00 GMT  
 Access97 and Word97 (MailMerge)

        << can anyone tell me how it can be done to programmatically
change

Quote:
> the DataSource of a mailmerge-object? >>

        Please see the code snippet I published in the "Mailmerge
problem" thread in this newsgroup.

/****************************************************

// Paris - FRANCE             Web: http://www.erb.com
/****************************************************



Sat, 28 Oct 2000 03:00:00 GMT  
 Access97 and Word97 (MailMerge)

Thank you, Hans
Merci, Frank

Now it works as I want it to do.
GUENTER

  vcard.vcf
< 1K Download


Sun, 29 Oct 2000 03:00:00 GMT  
 Access97 and Word97 (MailMerge)

Hi,

Thanks to all, who replied, now my application works as I want it to.
One problem I encoutered was, that ACCESS does not automatically close, when
you close the word.application, but you can overcome this by using the .DDETerminateAll Method.

regards
GUENTER

  vcard.vcf
< 1K Download


Sun, 29 Oct 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Access97/Word97 MailMerge

2. OLE Mailmerge Automation Error 5987 to Word97

3. (Q) Word97 MailMerge Data sources

4. accessing word97 MailMerge fields in HEADER

5. mailmerge with word97,2000,xp using vb.net,vb6

6. mailmerge with word97,2000,xp using vb6,vb.net

7. mailmerge with secure database (Word97 vb5)

8. VB6 - Word97. Mailmerge Automation

9. Mailmerge with secure access database (word97 vb5)

10. Mailmerge with word97 or word 2000

11. How can I do MS WORD97 MailMerge Funtion in VB6

12. Closing Word97 from Access97

 

 
Powered by phpBB® Forum Software