+ Reply to Thread
Results 1 to 2 of 2

Thread: How to create a mail in outlook using vba

  1. #1
    Registered User
    Join Date
    06-14-2011
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Smile How to create a mail in outlook using vba

    any help is appreciated

  2. #2
    Valued Forum Contributor
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    412

    Re: How to create a mail in outlook using vba

    try this code

    Private Sub sendEmail()
      Dim objMsg As MailItem
      ' create new outgoing message
      Set objMsg = Application.CreateItem(olMailItem)
       ' your reminder notification address
      objMsg.To = "email_address@someware.com"
      objMsg.Subject = "title"
      objMsg.HTMLBody = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML xmlns:st1 = 'urn:schemas-microsoft-com:office:smarttags' xmlns:o ='urn:schemas-microsoft-com:office:office'><HEAD><META http-equiv=Content-Type content='text/html; charset=windows-1250'></HEAD><BODY><font face=Arial size=2>some example text here ... but here you can add any valid HTML code or text</font></BODY></HTML>"
      'send the message
      objMsg.Send
      Set objMsg = Nothing
    End Sub
    It should works

    Best Regards
    MaczaQ (usually on forum Excel programming)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0