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 / February 2005

Tip: Looking for answers? Try searching our database.

Loosing data connection when automating merge

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jack - 10 Feb 2005 15:33 GMT
When automating the merge of a doc via VS.NET, I am loosing the data
connection with in the doc and thus getting erroneous results.  Has anyone
seen this behavior or know where to point me?

Here is a simplified call to the doc:

Private Sub PrintReport()

       Dim wordapp As ApplicationClass
       Dim wordDoc As Document
       wordapp = New ApplicationClass
       Dim sPages As String
       Dim sfullpath As String = "C:\Projects\TestWinApp\Output\in\test3.doc"
       If File.Exists(sfullpath) Then File.Delete(sfullpath)

       If File.Exists("C:\Projects\TestWinApp\newdoc.doc") Then
           wordDoc =
wordapp.Documents.Open("C:\Projects\TestWinApp\newdoc.doc")
           wordDoc.MailEnvelope "MergeUpdate")
           sPages =
wordDoc.Bookmarks.Item("Print").Range.ComputeStatistics(WdStatistic.wdStatisticPages)
           wordDoc.PrintOut(background:=True, Range:=4,
outputfilename:=sfullpath, Pages:="1-" & sPages)
           wordDoc.Close(True)
           wordDoc = Nothing       ' close doc
           wordapp.Quit()
           wordapp = Nothing       ' close word
       End If
       lblMain.Text += "File complete"
   End Sub
Signature

Jack Wooten
Application Developer

Jack - 10 Feb 2005 15:49 GMT
Please ignore the "wordDoc.MailEnvelope 'MergeUpdate')" in the previous post.
This was the beginnings of a solution search that I forgot to delete from
the code.
 
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.