Results 1 to 4 of 4

Thread: HTML Message

  1. #1
    Frenzied Member
    Join Date
    Aug 09
    Location
    Los Angeles
    Posts
    1,308

    HTML Message

    I cant seem to get my first line of the message to show:

    HTML Code:
    MsgGreeting = EmailForm.TextBox2.Value & " " & Recipient '& vbCrLf & vbCrLf
    MsgContent = Msg & EmailForm.TextBox3.Text
    
    Set MItem = OutlookApp.CreateItem(olMailItem)
    With MItem
    
    .To = EmailAddr
    .Subject = Subj
    '.Body = Msg
    .BodyFormat = 2 'olFormatHTML
    
    .HTMLBody = "<font face='Arial color=red> " & MsgGreeting & " </font>"
    .HTMLBody = MItem.HTMLBody & vbCrLf & "<font face='Arial color=blue> " & MsgContent & " </font><br/>"
    
    .Display
    SendKeys ("%{s}")
    
    End With

    this si not displayed at all

    .HTMLBody = "<font face='Arial color=red> " & MsgGreeting & " </font>"


    if I comment out the second line

    .HTMLBody = MItem.HTMLBody & vbCrLf & "<font face='Arial color=blue> " & MsgContent & " </font><br/>"



    then the first line shows up as text literal

  2. #2
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 07
    Location
    India
    Posts
    2,156

    Re: HTML Message

    concatenate all the things in a string variable then use it as a htmlbody, like this
    Code:
    StrHTML = "<font face='Arial color=red> " & MsgGreeting & " </font>"
    StrHTML = StrHTML & MItem.HTMLBody & vbCrLf & "<font face='Arial color=blue> " & MsgContent & " </font><br/>"
    .HTMLBody = StrHTML
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  3. #3
    Frenzied Member
    Join Date
    Aug 09
    Location
    Los Angeles
    Posts
    1,308

    Re: HTML Message

    Thanks

    Do you need to have the <html> and <Head> tags?

  4. #4
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 07
    Location
    India
    Posts
    2,156

    Re: HTML Message

    i think no need.
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


Posting Permissions

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