![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |