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 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.