I
Ian C
Hi
I'm trying to set up an Access database to create a mailmerge in Word using
automation. The merge itself works fine but in the process it opens a second
instance of the database, which I don't want.
I know the usual solution to this problem is to either clear the Application
Title in the Startup bar, or to put "Microsoft Access" in there. This has
worked when I've encountered the problem previously, but it's not working
this time.
The document I'm exporting to does not have any pre-existing DDE links, as
these are created as part of the code that creates the merge. Can anyone
suggest anything else I can look at to stop this happening?
I'm using Word and Access 2000. Here's the code:
objWD.Documents.Add Template:= _
"\\...file path...\letter.dot" _
, NewTemplate:=False, DocumentType:=0
objWD.ActiveDocument.MailMerge.OpenDataSource Name:= _
"\\...file path...\database.mdb", Connection:="TABLE
AcceptLettersTable"
objWD.ActiveDocument.MailMerge.Destination = wdSendToNewDocument
objWD.ActiveDocument.MailMerge.SuppressBlankLines = True
objWD.ActiveDocument.PageSetup.PaperSize = wdPaperA4
objWD.Visible = True
Thanks
Ian
I'm trying to set up an Access database to create a mailmerge in Word using
automation. The merge itself works fine but in the process it opens a second
instance of the database, which I don't want.
I know the usual solution to this problem is to either clear the Application
Title in the Startup bar, or to put "Microsoft Access" in there. This has
worked when I've encountered the problem previously, but it's not working
this time.
The document I'm exporting to does not have any pre-existing DDE links, as
these are created as part of the code that creates the merge. Can anyone
suggest anything else I can look at to stop this happening?
I'm using Word and Access 2000. Here's the code:
objWD.Documents.Add Template:= _
"\\...file path...\letter.dot" _
, NewTemplate:=False, DocumentType:=0
objWD.ActiveDocument.MailMerge.OpenDataSource Name:= _
"\\...file path...\database.mdb", Connection:="TABLE
AcceptLettersTable"
objWD.ActiveDocument.MailMerge.Destination = wdSendToNewDocument
objWD.ActiveDocument.MailMerge.SuppressBlankLines = True
objWD.ActiveDocument.PageSetup.PaperSize = wdPaperA4
objWD.Visible = True
Thanks
Ian