+ Reply to Thread
Results 1 to 3 of 3

Encode Text Of Body Of Email Into HTML

Hybrid View

  1. #1
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Encode Text Of Body Of Email Into HTML

    Mr. Leith Ross help me with this application. I was trying to take a macro he encoded for me into HTML and duplicate it to another macro. However when I do it, mine comes out all jumbled...

    Can someone please take a look and see what my issue is?? I appreciate the help!!!

    Sub RouteCAR()
        Dim OutApp As Object
        Dim OutMail As Object
        Dim strto As String, strcc As String, strbcc As String
        Dim strsub As String, strbody As String
        Dim wbName As String
        Dim ext As String
        Dim newFile As String, fName As String
        Dim URL As String
        
        URL = """file:///" & "S:\PROJECTS\Bakery Maint\Jason\CAR's Currently Routing"""
      
        If MsgBox(" Are You Sure You Are Ready To The CAR?", vbYesNo) <> vbYes Then Exit Sub
      
        Application.ScreenUpdating = False
      
        Application.Run ("NotApplicable()")
        
        ext = "S:\PROJECTS\Bakery Maint\Jason\CAR's Currently Routing\"
        wbName = Sheets("Approvals").Range("A5").Value
        ActiveWorkbook.SaveAs Filename:=ext & wbName
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        strto = Range("F9").Value
        strcc = ""
        strbcc = ""
        strsub = "CAR " & Range("A5").Value & " Is Ready For Your Initial Review"
        strbody = "<p>Hi " & Range("B9").Value & ": " & Range("A9").Value & "</p><br>" _
                      & "<p>Capital Project: " & Range("A5").Value & " From " & Range("F3").Value & " Is Ready For Your Initial Review.</p>" _
                      & "<br><br><a href=" & URL & ">Click Here To Open</a>"
    
        With OutMail
            .To = strto
            .CC = strcc
            .BCC = strbcc
            .Subject = strsub
            .Body = strbody
            'You can add a file to the mail like this
            '.Attachments.Add ("C:\test.txt")
            .Send    ' or use .Display
        End With
    
        Set OutMail = Nothing
        Set OutApp = Nothing
    
     ThisWorkbook.Close savechanges:=True
    
    End Sub
    Last edited by WJO; 03-14-2012 at 02:28 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Encode Text Of Body Of Email Into HTML

    Try .HTMLBody = strbody instead of .Body = strbody.

  3. #3
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Encode Text Of Body Of Email Into HTML

    Quote Originally Posted by Chippy View Post
    Try .HTMLBody = strbody instead of .Body = strbody.

    That did it...much thanks..

+ 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.6.0 RC 1