I'm using the Word Object Model to work with the body of a new e-mail
message in Outlook 2007. My goal is to simply clone the active e-mail into
one or more copies (the recipients from the source will each get their own
copy of the original, which will be trashed). I'm tried using
Document.Select, then Application.Copy on the source e-mail, followed by
Document.Activate, Document.Select (the Document objects are specific to the
cloned item, not the source), Application.Selection.WholeStory and then
Application.Selection.PasteAndFormat(wdPasteDefault) on each newly cloned
e-mail. However, there are times when I get a locked for editing warning
and the cloning fails - empty message body; this occurs inconsistently.

Is there a better approach to cloning the contents of a Document object in
situations like this where the documents are not file based?

--
Eric Legault [MVP - Outlook]
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007
& WSS 3.0 Application Development)
President
Collaborative Innovations
-> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
-> Take your SharePoint content offline <-
-> More info: http://www.collaborativeinnovations.ca <-
Blog: http://blogs.officezealot.com/legault

Re: Cloning document content to new docs by Tony

Tony
Mon Jul 14 15:05:39 PDT 2008

If you have the Document (WordEditor) object in Outlook 2007 you should be
able to work with the document like any other - regardless of whether it
exists on disc. Not sure from what you say what might cause a locked error.

You should neither need to Select, nor Activate, any Documents if you have
references to them. Document1.Content.Copy followed by Document2.Range.Paste
should be sufficient for most purposes. Or even avoiding the clipboard:
Document2.Range.InsertAfter Document1.Range

But ... I don't quite follow what you are doing. Why do you want to create
multiple copies at source? Won't a single copy get replicated when you send
it?

--
Enjoy,
Tony

"Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org> wrote in
message news:4D2B6908-E356-44D8-897D-D7BC8A3E6199@microsoft.com...
> I'm using the Word Object Model to work with the body of a new e-mail
> message in Outlook 2007. My goal is to simply clone the active e-mail
> into one or more copies (the recipients from the source will each get
> their own copy of the original, which will be trashed). I'm tried using
> Document.Select, then Application.Copy on the source e-mail, followed by
> Document.Activate, Document.Select (the Document objects are specific to
> the cloned item, not the source), Application.Selection.WholeStory and
> then Application.Selection.PasteAndFormat(wdPasteDefault) on each newly
> cloned e-mail. However, there are times when I get a locked for editing
> warning and the cloning fails - empty message body; this occurs
> inconsistently.
>
> Is there a better approach to cloning the contents of a Document object in
> situations like this where the documents are not file based?
>
> --
> Eric Legault [MVP - Outlook]
> MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS
> 2007 & WSS 3.0 Application Development)
> President
> Collaborative Innovations
> -> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
> -> Take your SharePoint content offline <-
> -> More info: http://www.collaborativeinnovations.ca <-
> Blog: http://blogs.officezealot.com/legault


Re: Cloning document content to new docs by Eric

Eric
Mon Jul 14 18:02:49 PDT 2008

Thanks Tony, I'll try those methods.

The process is the user creates one e-mail and inserts all To, Cc and Bcc
recipients. The user clicks a button and the code then creates a separate
e-mail for each recipient and kills the original. There's special unique
URLs on hyperlinked text that's generated within each of those e-mails that
track which user clicked them.

--
Eric Legault [MVP - Outlook]
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007
& WSS 3.0 Application Development)
Collaborative Innovations
NEW! -> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
Web: http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault


"Tony Jollans" <My forename at my surname dot com> wrote in message
news:#F$CG3f5IHA.3420@TK2MSFTNGP05.phx.gbl...
> If you have the Document (WordEditor) object in Outlook 2007 you should be
> able to work with the document like any other - regardless of whether it
> exists on disc. Not sure from what you say what might cause a locked
> error.
>
> You should neither need to Select, nor Activate, any Documents if you have
> references to them. Document1.Content.Copy followed by
> Document2.Range.Paste should be sufficient for most purposes. Or even
> avoiding the clipboard: Document2.Range.InsertAfter Document1.Range
>
> But ... I don't quite follow what you are doing. Why do you want to create
> multiple copies at source? Won't a single copy get replicated when you
> send it?
>
> --
> Enjoy,
> Tony
>
> "Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org> wrote in
> message news:4D2B6908-E356-44D8-897D-D7BC8A3E6199@microsoft.com...
>> I'm using the Word Object Model to work with the body of a new e-mail
>> message in Outlook 2007. My goal is to simply clone the active e-mail
>> into one or more copies (the recipients from the source will each get
>> their own copy of the original, which will be trashed). I'm tried using
>> Document.Select, then Application.Copy on the source e-mail, followed by
>> Document.Activate, Document.Select (the Document objects are specific to
>> the cloned item, not the source), Application.Selection.WholeStory and
>> then Application.Selection.PasteAndFormat(wdPasteDefault) on each newly
>> cloned e-mail. However, there are times when I get a locked for editing
>> warning and the cloning fails - empty message body; this occurs
>> inconsistently.
>>
>> Is there a better approach to cloning the contents of a Document object
>> in situations like this where the documents are not file based?
>>
>> --
>> Eric Legault [MVP - Outlook]
>> MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS
>> 2007 & WSS 3.0 Application Development)
>> President
>> Collaborative Innovations
>> -> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
>> -> Take your SharePoint content offline <-
>> -> More info: http://www.collaborativeinnovations.ca <-
>> Blog: http://blogs.officezealot.com/legault
>

Re: Cloning document content to new docs by Doug

Doug
Mon Jul 14 16:34:47 PDT 2008

Hi Eric,

See the code in the article "Mail Merge to E-mail with Attachments" at:

http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org> wrote in
message news:4D2B6908-E356-44D8-897D-D7BC8A3E6199@microsoft.com...
> I'm using the Word Object Model to work with the body of a new e-mail
> message in Outlook 2007. My goal is to simply clone the active e-mail
> into one or more copies (the recipients from the source will each get
> their own copy of the original, which will be trashed). I'm tried using
> Document.Select, then Application.Copy on the source e-mail, followed by
> Document.Activate, Document.Select (the Document objects are specific to
> the cloned item, not the source), Application.Selection.WholeStory and
> then Application.Selection.PasteAndFormat(wdPasteDefault) on each newly
> cloned e-mail. However, there are times when I get a locked for editing
> warning and the cloning fails - empty message body; this occurs
> inconsistently.
>
> Is there a better approach to cloning the contents of a Document object in
> situations like this where the documents are not file based?
>
> --
> Eric Legault [MVP - Outlook]
> MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS
> 2007 & WSS 3.0 Application Development)
> President
> Collaborative Innovations
> -> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
> -> Take your SharePoint content offline <-
> -> More info: http://www.collaborativeinnovations.ca <-
> Blog: http://blogs.officezealot.com/legault