Automate File > Send To > Mail Recipient

J

Jim

Here's the issue. I have a document that is 765 pages long. Each
page has an eMail address on the first line, and is then followed by a
list of user IDs and then a page break.

I want to automate a process that sends an individual page to the
eMail address that's listed at the top of the page. What I tried was
copying the text up to the page break, creating a new document, and
then sending it.

Everything worked fine.... I could copy the text, create a new
document from it by pasting from the clipboard, but when it came
around to actually sending it, that's when it blew up.... My original
document looks something like this:

(e-mail address removed)

felicia.fento
suzanne.germ
cheryl.jas
chad.laff
kristin.lavo
dawn.le
tabitha.ma
jean.mers

(page break)

(e-mail address removed)

daniel.gar
victoria.james
michael.kaff
mikhail.mentsch
amy.owens
jessica.spragg
enid.trini
janet.tschet

(page break)

(e-mail address removed)

jesse.fox
nicole.jones
ashlee.koest
valerie.lyons
tianna.mudd
katy.pop
jenny.rodriguez

(page break)

etc...


After I create the new document and paste in the data, how can I then
send it to the eMail address listed at the top of it?

Any ideas would be helpful.
 
D

Doug Robbins - Word MVP

You could modify the following macro by using the relevant information from
either of the two articles to which I make reference later in this post.



Sub splitter()

'

' splitter Macro

' Macro created 16-08-98 by Doug Robbins to save each page of a document

' as a separate file with the name Page#.DOC

'

Dim Counter As Long, Source As Document, Target As Document

Set Source = ActiveDocument

Selection.HomeKey Unit:=wdStory

Pages = Source.BuiltInDocumentProperties(wdPropertyPages)

Counter = 0

While Counter < Pages

Counter = Counter + 1

DocName = "Page" & Format(Counter)

Source.Bookmarks("\Page").Range.Cut

Set Target = Documents.Add

Target.Range.Paste

Target.SaveAs FileName:=DocName

Target.Close

Wend

End Sub

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

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

See the article "How to send an email from Word using VBA" at:

http://www.word.mvps.org/FAQs/InterDev/SendMail.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
 
J

Jim

You could modify the following macro by using the relevant information from
either of the two articles to which I make reference later in this post.

Sub splitter()

'

' splitter Macro

' Macro created 16-08-98 by Doug Robbins to save each page of a document

' as a separate file with the name Page#.DOC

'

Dim Counter As Long, Source As Document, Target As Document

Set Source = ActiveDocument

Selection.HomeKey Unit:=wdStory

Pages = Source.BuiltInDocumentProperties(wdPropertyPages)

Counter = 0

While Counter < Pages

    Counter = Counter + 1

    DocName = "Page" & Format(Counter)

    Source.Bookmarks("\Page").Range.Cut

    Set Target = Documents.Add

    Target.Range.Paste

    Target.SaveAs FileName:=DocName

    Target.Close

Wend

End Sub

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

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

See the article "How to send an email from Word using VBA" at:

http://www.word.mvps.org/FAQs/InterDev/SendMail.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









- Show quoted text -

Is there a way for me to pass the contents of the clipboard (ie
"(e-mail address removed)") to the "To" field in an eMail? If I can do this,
I'm home free!
 
D

Doug Robbins - Word MVP

Assuming that you have code something like this

With oItem
'Set the recipient for the new email
.To = "(e-mail address removed)"
'Set the recipient for a copy
.CC = "(e-mail address removed)"
'Set the subject
.Subject = "New subject"
'The content of the document is used as the body for the email
.Body = ActiveDocument.Content
.Send
End With

and the email address is in the first paragraph of the document, use

With oItem
'Set the recipient for the new email
.To = ActiveDocument.Paragraphs(1).Range.Text
'Set the recipient for a copy
.CC = "(e-mail address removed)"
'Set the subject
.Subject = "New subject"
'The content of the document is used as the body for the email
.Body = ActiveDocument.Content
.Send
End With


--
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

You could modify the following macro by using the relevant information
from
either of the two articles to which I make reference later in this post.

Sub splitter()

'

' splitter Macro

' Macro created 16-08-98 by Doug Robbins to save each page of a document

' as a separate file with the name Page#.DOC

'

Dim Counter As Long, Source As Document, Target As Document

Set Source = ActiveDocument

Selection.HomeKey Unit:=wdStory

Pages = Source.BuiltInDocumentProperties(wdPropertyPages)

Counter = 0

While Counter < Pages

Counter = Counter + 1

DocName = "Page" & Format(Counter)

Source.Bookmarks("\Page").Range.Cut

Set Target = Documents.Add

Target.Range.Paste

Target.SaveAs FileName:=DocName

Target.Close

Wend

End Sub

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

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

See the article "How to send an email from Word using VBA" at:

http://www.word.mvps.org/FAQs/InterDev/SendMail.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









- Show quoted text -

Is there a way for me to pass the contents of the clipboard (ie
"(e-mail address removed)") to the "To" field in an eMail? If I can do this,
I'm home free!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top