Outlook automation formatting text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Giganews

    #1

    Outlook automation formatting text

    I am currently working on an Outlook automation module in an Access 97
    database. All is working well except now the client wants the generic email
    body to contain certain sections in red text and others in blue text. Can
    this be done? If so how? I understand that I may have to send this email in
    HTML format which is not a problem. Any help would be much appreciated.

    Mark


  • Barmaley

    #2
    Re: Outlook automation formatting text


    "Giganews" <hereinde@yahoo .com> wrote in message
    news:oqCdnSXym5 lzzO_fRVn-pw@comcast.com. ..[color=blue]
    > I am currently working on an Outlook automation module in an Access 97
    > database. All is working well except now the client wants the generic[/color]
    email[color=blue]
    > body to contain certain sections in red text and others in blue text. Can
    > this be done? If so how? I understand that I may have to send this email[/color]
    in[color=blue]
    > HTML format which is not a problem. Any help would be much appreciated.
    >
    > Mark[/color]


    Try this
    ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~
    Sub Send_HTML_email ()
    Dim olApp As Outlook.Applica tion
    Dim olNs As NameSpace
    Dim Fldr As MAPIFolder
    Dim olMail As Variant
    Dim myItem As Object
    Dim msg As Object

    Set olApp = New Outlook.Applica tion
    Set olNs = olApp.GetNamesp ace("MAPI")
    Set myItem = olApp.CreateIte m(olMailItem)
    Q = Chr(34)
    Br = ">"

    Email_Body = "Build your HTML code here"
    myItem.Display

    myItem.To = "your recepient"
    myItem.Subject = Date & " " & Time '"HTML test"
    myItem.HTMLBody = Email_Body

    myItem.Send
    End Sub
    ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~

    AvP


    Comment

    • Giganews

      #3
      Re: Outlook automation formatting text

      Barmaley,

      Thanks for your reply but I am not sure I understand. Does the Q = Chr(34)
      and BR=">" mean something? I have code similar to the below already built
      and the process runs fine. I am just not sure were in the Email_Body =
      section due I put HTML code to make the text different colors. I am not sure
      how to write this. I have always used just plain text as the body during
      automation in the past.

      Thanks,
      Mark




      "Barmaley" <someone@nowher e.com> wrote in message
      news:d4tq2t$5hg $1@cnss.gov.ab. ca...[color=blue]
      >
      > "Giganews" <hereinde@yahoo .com> wrote in message
      > news:oqCdnSXym5 lzzO_fRVn-pw@comcast.com. ..[color=green]
      >> I am currently working on an Outlook automation module in an Access 97
      >> database. All is working well except now the client wants the generic[/color]
      > email[color=green]
      >> body to contain certain sections in red text and others in blue text. Can
      >> this be done? If so how? I understand that I may have to send this email[/color]
      > in[color=green]
      >> HTML format which is not a problem. Any help would be much appreciated.
      >>
      >> Mark[/color]
      >
      >
      > Try this
      > ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~
      > Sub Send_HTML_email ()
      > Dim olApp As Outlook.Applica tion
      > Dim olNs As NameSpace
      > Dim Fldr As MAPIFolder
      > Dim olMail As Variant
      > Dim myItem As Object
      > Dim msg As Object
      >
      > Set olApp = New Outlook.Applica tion
      > Set olNs = olApp.GetNamesp ace("MAPI")
      > Set myItem = olApp.CreateIte m(olMailItem)
      > Q = Chr(34)
      > Br = ">"
      >
      > Email_Body = "Build your HTML code here"
      > myItem.Display
      >
      > myItem.To = "your recepient"
      > myItem.Subject = Date & " " & Time '"HTML test"
      > myItem.HTMLBody = Email_Body
      >
      > myItem.Send
      > End Sub
      > ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~
      >
      > AvP
      >
      >[/color]


      Comment

      Working...