C
_Carolyn
I am doing a mail merge from Access and keep getting an error:
5852 Requested object is not available.
I did a search and found many people have this error and I dont see any
resolution. .Destination = wdSendToNewDocument 5852
Its Access 2003 calling Word 2003, in vba code.
It bombs out at -->.Destination = wdSendToNewDocument
Thank you,
Carolyn
-----code below------------
On Error GoTo errHandler
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open FileName:="Conversion_ClientLetter1.doc",
ConfirmConversions _
:=False, ReadOnly:=True, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:=""
With oApp.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
.LastRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
End With
.Execute Pause:=False
End With
5852 Requested object is not available.
I did a search and found many people have this error and I dont see any
resolution. .Destination = wdSendToNewDocument 5852
Its Access 2003 calling Word 2003, in vba code.
It bombs out at -->.Destination = wdSendToNewDocument
Thank you,
Carolyn
-----code below------------
On Error GoTo errHandler
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open FileName:="Conversion_ClientLetter1.doc",
ConfirmConversions _
:=False, ReadOnly:=True, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:=""
With oApp.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
.LastRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
End With
.Execute Pause:=False
End With