Macro

P

Phil

I have created a macro that automatically attaches a document to an e-mail with the subject line completed, but also wish to have the e-mail address that I wish to send the mail specified in the macro. I have found how this is done with the SendFax Method, but cannot work out how to apply the address in the SendMail Method.

Any help greatfully received!

Phil.
 
H

Helmut Weber

Hi Phil,
how about this:
Sub MyMail()
Dim oOtl As Outlook.Application
Set oOtl = New Outlook.Application
Dim oOtlItem As MailItem
With oOtl
Set oOtlItem = .CreateItem(olMailItem)
With oOtlItem
.To = "(e-mail address removed)"
.Subject = "Hi all"
.Attachments.Add ActiveDocument.FullName
' .Display ' Testing
' .Send ' uncomment one of these 2 lines
End With
End With
End Sub
You'll need a reference to the Outlook-Library.
VBA-Editor "Extras, References"
check "Outlook xx Type Library".

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 

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