J
James P. McNellis
All--
I am having some trouble with a Microsoft Access application that utilizes
Microsoft Word's MailMerge functionality through a VBA module.
Supposively this application worked fine in Office 2000, but I am unable to
locate a copy of Office 2000 on which to test it.
DoCmd.TransferText acExportMerge, "", sPrintTable, sMergeDataFile
The code starts off as follows:
Set WordObj = CreateObject("Word.Application")
WordObj.Visible = False
WordObj.Documents.Open FileName:=sWinWordFile
WordObj.ActiveDocument.MailMerge.Destination = wdSendToNewDocument
That last line there is what causes the error:
Microsoft Visual Basic
Run-time error '5852':
Requested object is not available.
sWinWordFile is a string and I have checked the path and it is the correct
path to the document I want to open. When I debug the module, it states
that WordObj.ActiveDocument.MailMerge.Destination = -1.
The code continues as follows, just to give context to the above code:
WordObj.Documents(sWinWordFile).MailMerge.Execute
WordObj.ActiveDocument.SaveAs FileName:=sMergedFile
Does anyone have any suggestions? I've been trying to figure this out for
over a week, to no avail.
Thanks in advance, both for taking the time to read my post, and for helping
to find a solution. I sincerely appreciate the efforts of these Microsoft
newsgroups.
Sincerely,
James McNellis
I am having some trouble with a Microsoft Access application that utilizes
Microsoft Word's MailMerge functionality through a VBA module.
Supposively this application worked fine in Office 2000, but I am unable to
locate a copy of Office 2000 on which to test it.
DoCmd.TransferText acExportMerge, "", sPrintTable, sMergeDataFile
The code starts off as follows:
Set WordObj = CreateObject("Word.Application")
WordObj.Visible = False
WordObj.Documents.Open FileName:=sWinWordFile
WordObj.ActiveDocument.MailMerge.Destination = wdSendToNewDocument
That last line there is what causes the error:
Microsoft Visual Basic
Run-time error '5852':
Requested object is not available.
sWinWordFile is a string and I have checked the path and it is the correct
path to the document I want to open. When I debug the module, it states
that WordObj.ActiveDocument.MailMerge.Destination = -1.
The code continues as follows, just to give context to the above code:
WordObj.Documents(sWinWordFile).MailMerge.Execute
WordObj.ActiveDocument.SaveAs FileName:=sMergedFile
Does anyone have any suggestions? I've been trying to figure this out for
over a week, to no avail.
Thanks in advance, both for taking the time to read my post, and for helping
to find a solution. I sincerely appreciate the efforts of these Microsoft
newsgroups.
Sincerely,
James McNellis