View Single Post
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

I would suggest that you dim mergedoc as Document, then use
Set mergedoc = Documents.Open(Filename:= Path & "Merge.doc")
mergedoc.MailMerge.Destination = wdSendToNewDocument

to make sure that the document you are trying to use is actually the
mailmerge main document. Chances are that your problem is caused because
the ActiveDocument is not what you think it is

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"strider235" wrote in message
...
I've written some VB code behind an Access form button that performs a
mailmerge. It works great for Word/Access 2000. Here is a fragment:

Set oApp = CreateObject("Word.Application")
With oApp
' US Doc
.Visible = True
.Documents.Open FileName:=Path & "Merge.doc"
.ActiveDocument.MailMerge.Destination = wdSendToNewDocument

For 2002 I get a msg "Requested object is not available" on the last line.

I made changes to the code:
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open FileName:=Path & "Merge.doc"
Set oDoc = oApp.ActiveDocument
oDoc.Mailmerge.Destination = wdSendToNewDocument

and still get the error "Requested object is not available" on the last
line. I have used the VB debugger with watch points and 'oDoc' is the
document I expect it to be with mailmerge properties.
Ideas?
Thanks,
Don