Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
ksg ksg is offline
external usenet poster
 
Posts: 13
Default Automated Mail Merge Displaying unwanted Dialog Boxes

I am writing an application that will accept pipe "|" delimited text files
from other applications to be mail merged when receive. I can pick the files
up from the directory, open the main mail document and open the data source;
however when the opendatasource command is executed a dialog box pops up
asking "Text File Connection Properties". I need to pass all the information
for the mail merge programmatically. This program should run in the
background with no user interaction. I am using Visual Studio - Visual Basic
- Word 2003. The code I am using is below.

Any help would be appreciated.
'Logic for processing found files here.
Private Sub ProcessFile(ByVal filename As String, ByVal formfilename As
String, ByVal datafilename As String)
Dim wrdApp As Word.Application
Dim wrdDoc As Word._Document
Dim wrdSelection As Word.Selection
Dim wrdMailMerge As Word.MailMerge
Dim wrdMergeFields As Word.MailMergeField
Dim ApplicationDisplayAlerts As Word.WdAlertLevel

' Create an instance of Word and make it invisible.
wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
ApplicationDisplayAlerts = Word.WdAlertLevel.wdAlertsNone

' Open document.
wrdDoc = wrdApp.Documents.Open(formfilename)
wrdDoc.MailMerge.OpenDataSource(Name:=filename)
wrdMailMerge = wrdDoc.MailMerge()

' Perform mail merge.
wrdMailMerge.Destination = _
Word.WdMailMergeDestination.wdSendToPrinter
wrdMailMerge.Execute(False)

' Close the original form document
wrdDoc.Saved = True
wrdDoc.Close(False)

' Release References.
wrdSelection = Nothing
wrdMailMerge = Nothing
wrdMergeFields = Nothing
wrdDoc = Nothing
wrdApp = Nothing
End Sub 'ProcessFile



 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
printing difficultiies using mail merge in word flybynight Mailmerge 1 December 3rd 06 06:58 PM
Editing Mail Merge Recipients Stan W. Mailmerge 8 May 4th 06 05:03 AM
ASP.NET - Excel - Mail Merge in Word causes "Data Link Properties" dialog to appear. [email protected] Mailmerge 1 April 18th 06 02:38 PM
mail merge with attachments AS Mailmerge 5 April 9th 05 09:49 AM
How to remove unwanted formatting in mail merge for cells witn no Jim Mailmerge 3 March 4th 05 08:13 AM


All times are GMT +1. The time now is 06:22 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"