Link to home
Start Free TrialLog in
Avatar of btgtech
btgtechFlag for United States of America

asked on

Send email from Excel via dialog box

The code below works in Excel 2010 to send an e-mail via Outlook 2010 when a dialog box in Excel is clicked. However, it is not working with Excel 2013 and Outlook 2013. Why?

Sub Engr_Notification()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
    Dim quote As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    Set quote = Range.ActiveCell()

    strbody = "A new quote is ready for pricing. See Quote #" & quote

    On Error Resume Next
    With OutMail
        .To = "test@123.com"
        .CC = ""
        .BCC = ""
        .Subject = "A new RFQ is ready for pricing"
        .Body = strbody
        .Send
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial