Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2007

Tip: Looking for answers? Try searching our database.

Mail merge macro not adding MS Access query data to form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tcek - 22 Aug 2007 17:54 GMT
I have a batch file that loads a Word document and then runs a macro that
inserts  MS query results into a standard form letter.  The batch file will
run and load everything but the data does not appear in the printed output.
the batch file and macro appear below

Batch file to open document, print the form letter and close Word:

C:\Program Files\Microsoft Office\Office\WINWord.exe"
p:\private\TC\CLINSRV\AccessPrograms\EPOMonitoringPage1.doc
/mEPOMonitoringForm /mfileprintdefault /mpausemacroafterprinting /mfileexit
exit

Macro to insert MS query data:

Sub EPOMonitoringForm()
'
' EPOMonitoringForm Macro
' Macro recorded 8/22/2007 by TC,
'
   ChangeFileOpenDirectory "P:\private\TC\CLINSRV\AccessPrograms\"
   Documents.Open FileName:="EPOMonitoringPage1.doc", ConfirmConversions:= _
       False, ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
       PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
       WritePasswordTemplate:="", Format:=wdOpenFormatAuto
   With ActiveDocument.MailMerge
       .Destination = wdSendToPrinter
       .MailAsAttachment = False
       .MailAddressFieldName = ""
       .MailSubject = ""
       .SuppressBlankLines = False
       With .DataSource
           .FirstRecord = wdDefaultFirstRecord
           .LastRecord = wdDefaultLastRecord
       With Dialogs(wdDialogFilePrint)
   .Execute
     End With
       
       End With
   End With
End Sub
Peter Jamieson - 22 Aug 2007 18:24 GMT
The chances are that you need to apply the registry patch described in the
following article:

http://support.microsoft.com/kb/825765

Signature

Peter Jamieson
http://tips.pjmsn.me.uk

>I have a batch file that loads a Word document and then runs a macro that
> inserts  MS query results into a standard form letter.  The batch file
[quoted text clipped - 41 lines]
>    End With
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.