473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help with Automated Mail Merge

I have an application that puts data into an Excel spreadsheet. It then opens a Word doc that reads the data and either prints the resulting form letters or keeps the file open for viewing. This uses Office XP and worked fine until I applied SP3. now it crashes with the following error. "Requested object is not available" The crash occurs when I try to set the MailMerge.Destination. If I skip setting the destination the following message appears: "This method or property is not available because the document is not a mail merge main document." This tells me that I am now missing several steps.

Here is the code block that I have been using:

Dim wordApp As New Microsoft.Office.Interop.Word.Application
wordApp.Visible = True
Dim wordDoc As Microsoft.Office.Interop.Word.Document = wordApp.Documents.Open("formletter.doc", , True, False)

'Output the Mail Merge to the chosen destination
Try
If bolOutputPrinter Then
wordDoc.MailMerge.Destination = Microsoft.Office.Interop.Word.WdMailMergeDestinati on.wdSendToPrinter
wordDoc.MailMerge.Execute()
wordDoc.Close(False)
wordApp.Quit(False)
Else
wordDoc.MailMerge.Destination = Microsoft.Office.Interop.Word.WdMailMergeDestinati on.wdSendToNewDocument
wordDoc.MailMerge.Execute()
wordDoc.Close(False)
End If
Catch e As Exception
MessageBox.Show("An Exception Occurred in application, Please notify DB Admin of the following message: " & Chr(13) & Chr(13) & e.ToString, "Error in Application")
End Try
I have made sure that I am using the latest PIAs by downloading them from the following site: http://www.microsoft.com/downloads/d...displaylang=en and installing them as per the instructions. I also refreshed the refferences in my application. I plan to use this type of reporting system in the future as it is easy to set up. However I need to know where I have gone wrong and what I need to do different when we migrate to Office 2003.

Please help,
Kaytrim

Nov 20 '05 #1
0 1052

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris | last post by:
We are currently using the following code to execute an automated mail merge in Windows 2000: Set AwordObj = New Word.Document Set AwordObj = AwordObj.Application.Documents.Add(file_path)...
2
by: Ian DeRock | last post by:
I'm fairly new to XML. As I can see it, XML is a way to organize data like in a table in a RDB, or the RDB itself. I have used XML in application data, but did not design the actual XML. I...
5
by: Tom Keane | last post by:
Okay, so the deal is, I am doing a mail merge document in order to print invoices. The field I get the amount of money is "invAmount". What I would like to do is be able to manipulate this number...
8
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
9
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access...
3
by: Richard Gilmore | last post by:
within my database I have a login form with a forgot password button when the button is clicked you are prompted to enter your email in frmforgotpassword this value is used for the parameters of...
1
by: mr k | last post by:
Hi, I wanted to use mail merge with forms but Text form fields are not retained during mail merge in Word, I got the code from Microsoft but it doesn't remember the text form field options such as...
1
by: =?Utf-8?B?VHJ1cHRpIERhbGlh?= | last post by:
Hi to all, I am new in this newsgroup and new to .NET also. I am creating an application where I have to perform Mail Merge from my program. I have created a form which contain RTB and user can...
0
by: truptidalia | last post by:
Hi, I am not that experienced in VB.NET. I am working on a application where i have to perform mail merge from the application. The application lets the userwrite letters, save them as rtf...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.