Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
mailmerge with VBA using ACCESS 2000 continue
Ater this line of code, insert
objWord.Application.ActiveDocument.PrintOut objWord.Application.ActiveDocument.Close wdDoNotSaveChanges Actually, I do not know why you have introduced the Application in that line of code, so you probably only need: objWord.ActiveDocument.PrintOut objWord.ActiveDocument.Close wdDoNotSaveChanges -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "olgaz" wrote in message ... Hello, This is my routine code: Public Sub fmailmerge(myskey As String) Dim objWord As Word.Document Dim strMergeDoc, str, str2 As String Dim mystudy As Variant Set objWord = GetObject(strMergeDoc, "Word.Document") objWord.Application.Visible = False objWord.MailMerge.OpenDataSource "\\fserver-xp\fshare\Pidu\StudysDocuments\EpiPneumo\Stikers.m db", , , , True, , , , , , , "QUERY CasesToday", "Select * from CasesToday where skey = '" & myskey & "'" objWord.MailMerge.Destination = wdSendToNewDocument The important thing is: objWord.MailMerge.Execute objWord.Application.Options.PrintBackground = False objWord.PageSetup.FirstPageTray = wdPrinterAutomaticSheetFeed objWord.PageSetup.OtherPagesTray = wdPrinterAutomaticSheetFeed objWord.Application.ActiveDocument.PrintOut I do not ask to save anything and I close Word: objWord.Close (wdDoNotSaveChanges) Set objWord = Nothing End Sub The program works well and the document can be printed. However, when login again, on the same computer, and opening Word, all those documents open automatically under the title recovered. How can I prevent this from happening each time? Thank you. You probably need objWord.Quit after the close. Peter Jamieson "olgaz" wrote in message news It's not working!!!!!!!!!!!!!!!!!! |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
mailmerge with VBA using ACCESS 2000 | Mailmerge | |||
Word 2000 mail merge documents won't save Access 2000 data source | Mailmerge | |||
Using Access 97 for Word 2000 Mailmerge | Mailmerge | |||
Mailmerge Word 2000 Access 2000 | Mailmerge | |||
MailMerge Word 2003 to Access 2000 query blank data | Mailmerge |