Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: Mailmerge in a macro

Geek News

Mailmerge in a macro
dave <dlevy[ at ]nyc.rr.com> 5/14/2007 5:17:43 PM
I have a mail merge that works very nicely, but when I try to run it
from a macro it errors out on the " .Destination =
wdSendToNewDocument" line telling me the "requested object is not
available". Any ideas? Thanks.

Documents.Open FileName:="""Policy projection main.doc""", _
ConfirmConversions:=False, ReadOnly:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:=
_
wdOpenFormatAuto, XMLTransform:=""
With 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

Re: Mailmerge in a macro
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 5/14/2007 5:28:48 PM
You probably need to do the registry fix described in

http://support.microsoft.com/kb/825765

Peter Jamieson

"dave" <dlevy[ at ]nyc.rr.com> wrote in message
news:1179163063.385560.225940[ at ]e51g2000hsg.googlegroups.com...
[Quoted Text]
>I have a mail merge that works very nicely, but when I try to run it
> from a macro it errors out on the " .Destination =
> wdSendToNewDocument" line telling me the "requested object is not
> available". Any ideas? Thanks.
>
> Documents.Open FileName:="""Policy projection main.doc""", _
> ConfirmConversions:=False, ReadOnly:=False,
> AddToRecentFiles:=False, _
> PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
> WritePasswordDocument:="", WritePasswordTemplate:="", Format:=
> _
> wdOpenFormatAuto, XMLTransform:=""
> With 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
>

Re: Mailmerge in a macro
dave <dlevy[ at ]nyc.rr.com> 5/14/2007 5:48:52 PM
yes. that worked. thank you.


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net