Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007 mailmerge from Access 2007
We have created a mail merge document, "Deposit Letter.docx" created in Word
2007, whereas the datasource is a paramenter query created in Access 2007, which is connected by a DDE connection. The word document can be opened from inside Access by selecting a button that has the command attached. The problem we have is when the document is selcted to be opened, it does not retrieve the data created by the query. It opens but will only show one page(the document will have multiple pages), that has old data inserted. To have the document show the current data from the query, the mail merge wizard has to be started and that whole process has to be completed each time. It seems to not keep the connection between the two applications. The goal is when the document is opened, the data from the query is inserted without having to go through the whole mail merge process. Thanks for any assistance. |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007 mailmerge from Access 2007
You /probably/ need to apply the registry change described in
http://support.microsoft.com/kb/825765/en-us -- Peter Jamieson http://tips.pjmsn.me.uk "jim" wrote in message ... We have created a mail merge document, "Deposit Letter.docx" created in Word 2007, whereas the datasource is a paramenter query created in Access 2007, which is connected by a DDE connection. The word document can be opened from inside Access by selecting a button that has the command attached. The problem we have is when the document is selcted to be opened, it does not retrieve the data created by the query. It opens but will only show one page(the document will have multiple pages), that has old data inserted. To have the document show the current data from the query, the mail merge wizard has to be started and that whole process has to be completed each time. It seems to not keep the connection between the two applications. The goal is when the document is opened, the data from the query is inserted without having to go through the whole mail merge process. Thanks for any assistance. |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007 mailmerge from Access 2007
I did change the registry key per the help document, but now I get a run-time
error 5640. Debugging the error, it highlights oApp.Documents.Open FileName:=LWordDoc in the module shown below. Private Sub Command0_Click() Dim LWordDoc As String Dim oApp As Object 'Path to the word document LWordDoc = "I:\Deposit Letter.docx" If Dir(LWordDoc) = "" Then MsgBox "Document not found." Else 'Create an instance of MS Word Set oApp = CreateObject(Class:="Word.Application") oApp.Visible = True 'Open the Document oApp.Documents.Open FileName:=LWordDoc End If Thanks for the help. "Peter Jamieson" wrote: You /probably/ need to apply the registry change described in http://support.microsoft.com/kb/825765/en-us -- Peter Jamieson http://tips.pjmsn.me.uk "jim" wrote in message ... We have created a mail merge document, "Deposit Letter.docx" created in Word 2007, whereas the datasource is a paramenter query created in Access 2007, which is connected by a DDE connection. The word document can be opened from inside Access by selecting a button that has the command attached. The problem we have is when the document is selcted to be opened, it does not retrieve the data created by the query. It opens but will only show one page(the document will have multiple pages), that has old data inserted. To have the document show the current data from the query, the mail merge wizard has to be started and that whole process has to be completed each time. It seems to not keep the connection between the two applications. The goal is when the document is opened, the data from the query is inserted without having to go through the whole mail merge process. Thanks for any assistance. |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007 mailmerge from Access 2007
I suggest you try creating the mail merge link in VBA once you have opened
the document. e.g., ensure that the document is not a mail merge main document (you will lose any sort/filter stuff, but all the fields should remain), then in your code, use something like Dim oDoc As Object 'or Word.Document if you want early binding Set oDoc = oApp.Documents.Open FileName:=LWordDoc oDoc.Mailmerge.OpenDataSource _ Name:="the full path name of your database", _ .Connection:="QUERY [the query name]", _ .SQLStatement:="SELECT * FROM [the query name]", _ .Subtype:=wdMergeSubtypeWord2000 ' then make sure othe oDoc.MailMerge properties such as mail merge type and destination are set the way you want. ' eventually, set oDoc = Nothing This is on-the-fly so I can't be sure that the parameters for OpenDataSource are correct in this case. You'll need this Subtype for Word 2002 and later to get a DDE connection, but you may be able to ditch the SQLStatement and the Connection may need to be different. You can inspect values for an existing DDE-connected document using VBA. Alternatively, you may find Albert Kallal's stuff at (I think) http://www.members.shaw.ca/AlbertKal.../msaccess.html a more reliable way to do this. -- Peter Jamieson http://tips.pjmsn.me.uk "jim" wrote in message ... I did change the registry key per the help document, but now I get a run-time error 5640. Debugging the error, it highlights oApp.Documents.Open FileName:=LWordDoc in the module shown below. Private Sub Command0_Click() Dim LWordDoc As String Dim oApp As Object 'Path to the word document LWordDoc = "I:\Deposit Letter.docx" If Dir(LWordDoc) = "" Then MsgBox "Document not found." Else 'Create an instance of MS Word Set oApp = CreateObject(Class:="Word.Application") oApp.Visible = True 'Open the Document oApp.Documents.Open FileName:=LWordDoc End If Thanks for the help. "Peter Jamieson" wrote: You /probably/ need to apply the registry change described in http://support.microsoft.com/kb/825765/en-us -- Peter Jamieson http://tips.pjmsn.me.uk "jim" wrote in message ... We have created a mail merge document, "Deposit Letter.docx" created in Word 2007, whereas the datasource is a paramenter query created in Access 2007, which is connected by a DDE connection. The word document can be opened from inside Access by selecting a button that has the command attached. The problem we have is when the document is selcted to be opened, it does not retrieve the data created by the query. It opens but will only show one page(the document will have multiple pages), that has old data inserted. To have the document show the current data from the query, the mail merge wizard has to be started and that whole process has to be completed each time. It seems to not keep the connection between the two applications. The goal is when the document is opened, the data from the query is inserted without having to go through the whole mail merge process. Thanks for any assistance. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mailmerge Access 2007 query | Mailmerge | |||
Mailmerge from Access 2007 to Word 2007 .docx document | Mailmerge | |||
Word 2007 Mailmerge with Access 2007 using DDE | Mailmerge | |||
insert Access 2007 database table into a Word 2007 doc and print | Microsoft Word Help | |||
Word 2007 and Outlook 2007 e-mail MailMerge does not complete | Mailmerge |