View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Email to from Excel

Here is the basic code

Sub SendEmail()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object

Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True

Set oMailItem = oOutlook.CreateItem(0)
Set oRecipient = oMailItem.Recipients.Add(Range("D12").value)
oRecipient.Type = 1
oMailItem.Subject = "an email from me"
oMailItem.Body = "How are you"
oMailItem.Send

End Sub

--
HTH

Bob Phillips

"Nigel" wrote in message
...
Hi,
There doesnt seem to be what i am looking for. it seems that everything on
the site will automatically send a sheet or a book. i only want to open
outlook to send my own email with my own subject etc. unless i am not

seeing
something.

nige

"Bob Phillips" wrote:

See http://ww.rondebruin.nl/sendmail.htm where this is covered.

--
HTH

Bob Phillips

"Nigel" wrote in message
...
Hi,
I have created a database for my company to use. I am looking for a

code
or
routine to help me on the following:
An email address is shown on the cell D12
I have written a code to change the cell contents from formula to

email.
I would like a button to copy the email address and open outlook to

create
an email to the specific address shown. I can do the rest but i am

really
stuck on this one.
If outlook is open, it may need an error handler to stop a second

instance
opening.

Summary:
i select my contact,
press a button,
outlook opens and the email address is in the "send to"

Regards,

Nigel