send mail using macro RRS feed

  • Question

  • Hi all,

    Iam trying to send mail through outlook but not getting the output. Here is the code below.

    when I am able to send the mail and check "send items" folder, it should not be there (mail should be auto deleted i.e. send item folder should be blank)

    Sub mail()

    Dim objOutlook As Object
    Dim objOutlookMsg As Object
    Set objOutlook = CreateObject("Outlook.Application")
    Set objOutlookMsg = objOutlook.CreateItem(0)
    With objOutlookMsg
       .To = ""
       '.Cc = ""
       .Subject = "Hello World (one more time)..."
       .Body = "This is the body of message"
       .HTMLBody = "HTML version of message"
       '.Attachments.Add ("c:\myFileToSend.txt")
       '.Send 'Let´s go!
    End With
    Set objOutlookMsg = Nothing
    Set objOutlook = Nothing

    End Sub


    Saturday, February 4, 2012 1:09 PM


  • DeleteAfterSubmit parameter


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved

    • Marked as answer by ashokbioinfo Sunday, February 5, 2012 2:51 PM
    Saturday, February 4, 2012 3:17 PM