Philosophaie
Active Member
- Joined
- Mar 5, 2010
- Messages
- 256
I am trying to send a Word Document as the body of an email. This is what I have from another post. I tried to add a:
Dim outlook as Outlook.Application
but I also am confused about you can use the "doc", a Word.Document, in the same statement as an Outlook.MailItem?
Set itm = doc.MailEnvelope.Item
Add two references: Word and Outlook.
Dim outlook as Outlook.Application
but I also am confused about you can use the "doc", a Word.Document, in the same statement as an Outlook.MailItem?
Set itm = doc.MailEnvelope.Item
Code:
Sub SendDocAsMsg()
Dim wd As Word.Application
Dim doc As Word.Document
Dim itm As Outlook.MailItem
Dim ID As String
Dim blnWeOpenedWord As Boolean
Set wd = CreateObject("Word.Application")
wd.Visible = True
Set doc = wd.Documents.Open(Filename:="C:\Users\this\toEmail.doc", ReadOnly:=True)
Set itm = doc.MailEnvelope.Item
With itm
.To = "[EMAIL="this@email"]this@email[/EMAIL].com"
.Subject = "My Subject"
.Send
End With
doc.Close
wd.Quit
Set doc = Nothing
Set itm = Nothing
Set wd = Nothing
End Sub
Add two references: Word and Outlook.