Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mailmerge Problem

Status
Not open for further replies.

bobparisi

Programmer
Apr 15, 2002
1
US
I have a VB app that automates Word mailmerge. It uses an Access database for input to mailmerge. The application works fine using word 2000 on windows 2000, however it abends using word 2003 on windoows XP.

I get “error 5852 requested object is not available”.

WordMailMerge.ActiveDocument.MailMerge.DataSource.FirstRecord = g_ID (where g_ID is the number of the record) kicks out error message.

Syntax/code:
g_ID = rs.Fields("ID")
g_FileLocation = rs.Fields("FileLocation")
g_FileName = rs.Fields("Filename")

If intFirstTimeThru = 1 Then
Dim WordMailMerge As Word.Application
Set WordMailMerge = CreateObject("word.application")
End If
WordMailMerge.Documents.Add
WordMailMerge.Visible = False
WordMailMerge.Documents.Open ("C:\HotDoc\5505.DOC")
WordMailMerge.ActiveDocument.MailMerge.DataSource.FirstRecord = g_ID

It blows out here……. Bear in mind that using word 2000 on windows 2000 - everything works fine. Word 2003 on windows xp – see above. Note vb word object reference was reset to word 11 on xp.

Any comments / suggestions would be appreciated.

 
I think this results from a new security setting in Word 2003, which prompts the user for verification when opening a datasource. The default value is no (No, don't attach the datasource), and when using automation, you are not given the opportunity to respond "yes". This security feature is also a problem in Word 2003 SP-3.
There is a workaround, but it involves a registry change.

I read about it in:
after much searching. I'll let you know if it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top