A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Copy Text from Word Doc into E-mail message



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 10th 06, 08:54 PM posted to microsoft.public.outlook
gumby
external usenet poster
 
Posts: 5
Default Copy Text from Word Doc into E-mail message

I have the following macro to send out an e-mail with an attachment.

Sub SendMailMorning()
Set objMail = Application.CreateItem(0)
With objMail
.Subject = "Subject"
.To = "address"
.CC = "address"
.BCC = "address"
.Attachments.Add "c:\temp\File.rtf"
.Send
End With
End Sub

However I would like to be able to take the text out of the word doc
and place it into the message of the e-mail instead of attaching it. Is
this possible?

Thanks -

  #2  
Old August 22nd 06, 11:58 PM posted to microsoft.public.outlook
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Copy Text from Word Doc into E-mail message

What Word doc? All the text or just some?

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/comm....program_v ba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"gumby" wrote in message ups.com...
I have the following macro to send out an e-mail with an attachment.

Sub SendMailMorning()
Set objMail = Application.CreateItem(0)
With objMail
.Subject = "Subject"
.To = "address"
.CC = "address"
.BCC = "address"
.Attachments.Add "c:\temp\File.rtf"
.Send
End With
End Sub

However I would like to be able to take the text out of the word doc
and place it into the message of the e-mail instead of attaching it. Is
this possible?

Thanks -

  #3  
Old August 23rd 06, 03:53 PM posted to microsoft.public.outlook
gumby
external usenet poster
 
Posts: 5
Default Copy Text from Word Doc into E-mail message

Thanks - I will check it out. I want all text and it is the word doc
that I am currently attaching. or .rtf.

David

Sue Mosher [MVP-Outlook] wrote:
What Word doc? All the text or just some?

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/comm....program_v ba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"gumby" wrote in message ups.com...
I have the following macro to send out an e-mail with an attachment.

Sub SendMailMorning()
Set objMail = Application.CreateItem(0)
With objMail
.Subject = "Subject"
.To = "address"
.CC = "address"
.BCC = "address"
.Attachments.Add "c:\temp\File.rtf"
.Send
End With
End Sub

However I would like to be able to take the text out of the word doc
and place it into the message of the e-mail instead of attaching it. Is
this possible?

Thanks -


  #4  
Old August 23rd 06, 04:12 PM posted to microsoft.public.outlook
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Copy Text from Word Doc into E-mail message

If you want all the text, you can use the "Office envelope" feature. This code starts Word if it isn't already running, opens your document, creates a message from it, saves and sends the message, then closes Word if appropriate:

Sub SendDocAsMsg()
Dim wd As Word.Application
Dim doc As Word.Document
Dim itm As Object
Dim ID As String
Dim blnWeOpenedWord As Boolean
On Error Resume Next

Set wd = GetObject(, "Word.Application")
If wd Is Nothing Then
Set wd = CreateObject("Word.Application")
blnWeOpenedWord = True
End If
Set doc = wd.Documents.Open _
(FileName:="c:\temp\File.rtf", ReadOnly:=True)
Set itm = doc.MailEnvelope.Item
With itm
.To = "Address"
.Subject = "Subject"
.Save
ID = .EntryID
End With
Set itm = Nothing

Set itm = Application.Session.GetItemFromID(ID)
itm.Send
doc.Close wdDoNotSaveChanges
If blnWeOpenedWord Then
wd.Quit
End If

Set doc = Nothing
Set itm = Nothing
Set wd = Nothing
End Sub

Note that this is Outlook VBA code and requires a reference to the Microsoft Word library in Tools | References.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"gumby" wrote in message ups.com...
Thanks - I will check it out. I want all text and it is the word doc
that I am currently attaching. or .rtf.

David

Sue Mosher [MVP-Outlook] wrote:
What Word doc? All the text or just some?

"gumby" wrote in message ups.com...
I have the following macro to send out an e-mail with an attachment.

Sub SendMailMorning()
Set objMail = Application.CreateItem(0)
With objMail
.Subject = "Subject"
.To = "address"
.CC = "address"
.BCC = "address"
.Attachments.Add "c:\temp\File.rtf"
.Send
End With
End Sub

However I would like to be able to take the text out of the word doc
and place it into the message of the e-mail instead of attaching it. Is
this possible?


  #5  
Old August 23rd 06, 10:55 PM posted to microsoft.public.outlook
gumby
external usenet poster
 
Posts: 5
Default Copy Text from Word Doc into E-mail message

Thanks, it worked like a charm. Would this method be the same for other
applications?

David

Sue Mosher [MVP-Outlook] wrote:
If you want all the text, you can use the "Office envelope" feature. This code starts Word if it isn't already running, opens your document, creates a message from it, saves and sends the message, then closes Word if appropriate:

Sub SendDocAsMsg()
Dim wd As Word.Application
Dim doc As Word.Document
Dim itm As Object
Dim ID As String
Dim blnWeOpenedWord As Boolean
On Error Resume Next

Set wd = GetObject(, "Word.Application")
If wd Is Nothing Then
Set wd = CreateObject("Word.Application")
blnWeOpenedWord = True
End If
Set doc = wd.Documents.Open _
(FileName:="c:\temp\File.rtf", ReadOnly:=True)
Set itm = doc.MailEnvelope.Item
With itm
.To = "Address"
.Subject = "Subject"
.Save
ID = .EntryID
End With
Set itm = Nothing

Set itm = Application.Session.GetItemFromID(ID)
itm.Send
doc.Close wdDoNotSaveChanges
If blnWeOpenedWord Then
wd.Quit
End If

Set doc = Nothing
Set itm = Nothing
Set wd = Nothing
End Sub

Note that this is Outlook VBA code and requires a reference to the Microsoft Word library in Tools | References.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"gumby" wrote in message ups.com...
Thanks - I will check it out. I want all text and it is the word doc
that I am currently attaching. or .rtf.

David

Sue Mosher [MVP-Outlook] wrote:
What Word doc? All the text or just some?

"gumby" wrote in message ups.com...
I have the following macro to send out an e-mail with an attachment.

Sub SendMailMorning()
Set objMail = Application.CreateItem(0)
With objMail
.Subject = "Subject"
.To = "address"
.CC = "address"
.BCC = "address"
.Attachments.Add "c:\temp\File.rtf"
.Send
End With
End Sub

However I would like to be able to take the text out of the word doc
and place it into the message of the e-mail instead of attaching it. Is
this possible?


  #6  
Old August 24th 06, 12:40 AM posted to microsoft.public.outlook
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Copy Text from Word Doc into E-mail message

Excel also supports this technique, so you could rewrite it to use Excel objects instead of Word.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"gumby" wrote in message oups.com...
Thanks, it worked like a charm. Would this method be the same for other
applications?

David

Sue Mosher [MVP-Outlook] wrote:
If you want all the text, you can use the "Office envelope" feature. This code starts Word if it isn't already running, opens your document, creates a message from it, saves and sends the message, then closes Word if appropriate:

Sub SendDocAsMsg()
Dim wd As Word.Application
Dim doc As Word.Document
Dim itm As Object
Dim ID As String
Dim blnWeOpenedWord As Boolean
On Error Resume Next

Set wd = GetObject(, "Word.Application")
If wd Is Nothing Then
Set wd = CreateObject("Word.Application")
blnWeOpenedWord = True
End If
Set doc = wd.Documents.Open _
(FileName:="c:\temp\File.rtf", ReadOnly:=True)
Set itm = doc.MailEnvelope.Item
With itm
.To = "Address"
.Subject = "Subject"
.Save
ID = .EntryID
End With
Set itm = Nothing

Set itm = Application.Session.GetItemFromID(ID)
itm.Send
doc.Close wdDoNotSaveChanges
If blnWeOpenedWord Then
wd.Quit
End If

Set doc = Nothing
Set itm = Nothing
Set wd = Nothing
End Sub

Note that this is Outlook VBA code and requires a reference to the Microsoft Word library in Tools | References.


  #7  
Old September 13th 06, 09:47 PM posted to microsoft.public.outlook
gumby
external usenet poster
 
Posts: 5
Default Copy Text from Word Doc into E-mail message

Going back to my attachment code at the top. How would I attach more
than one file?

Thanks,
David


Sue Mosher [MVP-Outlook] wrote:
If you want all the text, you can use the "Office envelope" feature. This code starts Word if it isn't already running, opens your document, creates a message from it, saves and sends the message, then closes Word if appropriate:

Sub SendDocAsMsg()
Dim wd As Word.Application
Dim doc As Word.Document
Dim itm As Object
Dim ID As String
Dim blnWeOpenedWord As Boolean
On Error Resume Next

Set wd = GetObject(, "Word.Application")
If wd Is Nothing Then
Set wd = CreateObject("Word.Application")
blnWeOpenedWord = True
End If
Set doc = wd.Documents.Open _
(FileName:="c:\temp\File.rtf", ReadOnly:=True)
Set itm = doc.MailEnvelope.Item
With itm
.To = "Address"
.Subject = "Subject"
.Save
ID = .EntryID
End With
Set itm = Nothing

Set itm = Application.Session.GetItemFromID(ID)
itm.Send
doc.Close wdDoNotSaveChanges
If blnWeOpenedWord Then
wd.Quit
End If

Set doc = Nothing
Set itm = Nothing
Set wd = Nothing
End Sub

Note that this is Outlook VBA code and requires a reference to the Microsoft Word library in Tools | References.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"gumby" wrote in message ups.com...
Thanks - I will check it out. I want all text and it is the word doc
that I am currently attaching. or .rtf.

David

Sue Mosher [MVP-Outlook] wrote:
What Word doc? All the text or just some?

"gumby" wrote in message ups.com...
I have the following macro to send out an e-mail with an attachment.

Sub SendMailMorning()
Set objMail = Application.CreateItem(0)
With objMail
.Subject = "Subject"
.To = "address"
.CC = "address"
.BCC = "address"
.Attachments.Add "c:\temp\File.rtf"
.Send
End With
End Sub

However I would like to be able to take the text out of the word doc
and place it into the message of the e-mail instead of attaching it. Is
this possible?


  #8  
Old September 13th 06, 10:03 PM posted to microsoft.public.outlook
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Copy Text from Word Doc into E-mail message

If what you have now is:

.Attachments.Add "c:\temp\File.rtf"

then to add another attached file, you'd repeat that statement:

.Attachments.Add "c:\temp\File2.rtf"

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"gumby" wrote in message oups.com...
Going back to my attachment code at the top. How would I attach more
than one file?

Thanks,
David


Sue Mosher [MVP-Outlook] wrote:
If you want all the text, you can use the "Office envelope" feature. This code starts Word if it isn't already running, opens your document, creates a message from it, saves and sends the message, then closes Word if appropriate:

Sub SendDocAsMsg()
Dim wd As Word.Application
Dim doc As Word.Document
Dim itm As Object
Dim ID As String
Dim blnWeOpenedWord As Boolean
On Error Resume Next

Set wd = GetObject(, "Word.Application")
If wd Is Nothing Then
Set wd = CreateObject("Word.Application")
blnWeOpenedWord = True
End If
Set doc = wd.Documents.Open _
(FileName:="c:\temp\File.rtf", ReadOnly:=True)
Set itm = doc.MailEnvelope.Item
With itm
.To = "Address"
.Subject = "Subject"
.Save
ID = .EntryID
End With
Set itm = Nothing

Set itm = Application.Session.GetItemFromID(ID)
itm.Send
doc.Close wdDoNotSaveChanges
If blnWeOpenedWord Then
wd.Quit
End If

Set doc = Nothing
Set itm = Nothing
Set wd = Nothing
End Sub

Note that this is Outlook VBA code and requires a reference to the Microsoft Word library in Tools | References.

"gumby" wrote in message ups.com...
Thanks - I will check it out. I want all text and it is the word doc
that I am currently attaching. or .rtf.

David

Sue Mosher [MVP-Outlook] wrote:
What Word doc? All the text or just some?

"gumby" wrote in message ups.com...
I have the following macro to send out an e-mail with an attachment.

Sub SendMailMorning()
Set objMail = Application.CreateItem(0)
With objMail
.Subject = "Subject"
.To = "address"
.CC = "address"
.BCC = "address"
.Attachments.Add "c:\temp\File.rtf"
.Send
End With
End Sub

However I would like to be able to take the text out of the word doc
and place it into the message of the e-mail instead of attaching it. Is
this possible?


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
import a word doc. letterhead for e mail letterhead rupet 204 Outlook - Using Contacts 3 June 10th 06 12:18 PM
Word Doc to Access Liz Outlook - Using Contacts 1 April 28th 06 05:46 PM
Send a Word Doc as E-Mail Body goshute Outlook and VBA 3 April 9th 06 04:27 PM
sending rtf,doc,text as message body in outllook 2003 in vb.net Digit Solver Outlook - Using Forms 3 March 31st 06 04:37 PM
Insert a hyperlink to section of Word doc in an outlook message [email protected] Outlook - General Queries 0 February 8th 06 06:07 AM


All times are GMT +1. The time now is 12:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.