• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Open new email from Excel

Hi

I would like to have a button on my form which opens a new email message - I want the destination name populated and the subject to have details from the spreadsheet.

I don't want the email to send automatically.

I have the following.

Code:
Sub SendMeFromExcel()
    Dim EmailTo As String
    Dim oApp As Object
    Dim oItem As Object
   
    On Error GoTo ErrorHandler
   
    EmailTo = "lesley-ann.burlingham@cnhind.com"
   
    Set oApp = CreateObject("Outlook.Application")
    Set oItem = oApp.CreateItem(0)
   
    With oItem
        .To = EmailTo
        .Subject = "This is a test.  This email is being sent from Excel!!!"
        .Body = "You can put the body too"
        .Importance = 1
        .Send
    End With
   
    GoTo ExitSub
   
ErrorHandler:
    MsgBox "There was an error."
   
ExitSub:
    Set oItem = Nothing
    Set oApp = Nothing
End Sub
 
Hi,

I am not sure what u are looking for!!

To join the string in VBA use

"ABC" & "CD" & Range("A1") & "_" & "hello" & "how_" & "are" & "you!"

Or use Join(....., "-")
 
Back
Top