Send E-Mail Message

nehpets12

Active Member
Joined
Feb 22, 2002
Messages
453
A simple one for you :p

All I want To do Is Send An E-Mail Message To Someone Based On A Value Of A Cell something like ....

If Range("A1").Value = "Merlin" Then
.SendMail Recipients:=Array("Email Address"),subject:= "New Message",body:="New Spec"

There is a lot of help if I want to send workbook or selection or a sheet but I cant find any help if I just want to send a message.

Thank you in advance
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi, you can adapt this for your needs.
Cheers,
Jon

Code:
Sub Mailer()
  
Dim objol As New Outlook.Application
Dim objmail As MailItem
Dim Pathname

Pathname = ActiveWorkbook.FullName

Set objol = New Outlook.Application
Set objmail = objol.CreateItem(olMailItem)
    
    With objmail
        .To = "somebody@yahoo.com"
        .Subject = "Simulation completed!"
        .Body = "The following simulation has completed:" & _
            vbCrLf & Pathname
        .NoAging = True
        .Display
    End With
    Set objmail = Nothing
    Set objol = Nothing
    
    Application.Wait (Now + TimeValue("0:00:04"))
    Application.SendKeys "%s"
    Application.Wait (Now + TimeValue("0:00:04"))
    
End Sub
 
Upvote 0
Help with sending e-mail

Some operators are using office 2000 and some are using office 2003

is there anyway that VBA code can turn on the referances in vba project depending if 2000 or 2003

office 2000 uses Microsoft Outlook 9.0 Object Libary and

office 2003 uses Microsoft Outlook 11.0 Object Libary
 
Upvote 0

Forum statistics

Threads
1,215,334
Messages
6,124,321
Members
449,154
Latest member
pollardxlsm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top