This might help:
Sub CDOCreateMail()
Dim objCdoSession As MAPI.Session
Dim objNewMsg As MAPI.Message
Dim objOneRecip As Recipient
Dim strDoc As Word.Document
Set strDoc = ActiveDocument
Set objCdoSession = CreateObject("MAPI.Session")
'Logon in to Session entering your mailserver, an
' LineFeed and username.
objCdoSession.Logon "", "", , , , False, "ServerName" & vbLf &
"username"
'Create Email in Outbox
Set objNewMsg = objCdoSession.Outbox.Messages.Add
With objNewMsg
.Text = "See attached document" & vbCrLf
.Attachments.Add strDoc
.Subject = "My Subject"
'Fields is where you can access numerous properties
'That you can't access from Outlook's Object Library
'Plus many that you could
'For a Deferred Delivery Date
'.Fields.Add &HF0040, CDate("Oct. 31, 2003 14:00:00")
'If you want Plain text mail use the Name parameter
Set objOneRecip =
..Recipients.Add(Name:="(e-mail address removed)")
'If you use Address:="SMTP:
[email protected]" then
'Outlook sets Recipient to be sent RTF mail only
'If it doesn't find the recipient in your address
'book
'Set objOneRecip = .Recipients.Add(Address:="SMTP:" &
strEmail)
.Recipients.Resolve
.Update
.Send showDialog:=False
End With
Set objNewMsg = Nothing
objCdoSession.Logoff
Set objCdoSession = Nothing
End Sub
--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"
This message is posted to a newsgroup. Please post replies and
questions to the newsgroup so that others can learn as well.
hello
What kind of macro would work to send a document to a specified
email
address from Word?
In Excel you have the code:
Sub Send()
ActiveWorksheet.SendMail "(e-mail address removed)" _ "this
is subject"
End Sub
But it does not work in Word (in form ActiveDocument.SendMail)
The ActiveDocument.SendMail part works, but you cannot insert the
address
automatically.
Can anyone help, please?
We are talking about Word 2002 on Windows XP