SPAN Tag

  • As Font Tag was deprecated user can replace with SPAN tag, in case of HTML body of the Outlook mail item
  • This span tag allows the user to provide the formatting options on required content or some portion of the content
  • Below mentioned features can apply:

  • Change the font size
  • Change the font Name
  • Change the font color
  • chagne the background color
  • Apply bold property
  •  

    Download The Workbook

     

    Sub SpanTag_In_Automation()

    Dim OL As Outlook.Application
    Set OL = New Outlook.Application

    Dim M As Outlook.MailItem
    Set M = OL.CreateItem(olMailItem)

    BodyContent = "<p style = 'Font-size:25pt; color:black; font-family:Calibri';>Hi Every One <br>"
    BodyContent = BodyContent & "This program enunciates about the of Span Tag<br>"
    BodyContent = BodyContent & "Hope this is useful to everyone <br>"

    'Increase The Font Size
    BodyContent = BodyContent & "Increase The <span Style = 'Font-size:30pt';>Font </span>Size<br>"

    'Change the font name
    BodyContent = BodyContent & "Change The <span Style = 'font-family:Rosewood Std Regular'';>Font </span>Name<br>"

    'Change font The Color
    BodyContent = BodyContent & "Change The <span Style = 'color:Blue';>Font </span>Color<br>"

    'Change The Background Color
    BodyContent = BodyContent & "Change The <span Style = 'Background-color:#F00;'>BG </span>Color<br>"

    'Apply Italic Font Style
    BodyContent = BodyContent & "Apply <span Style = 'Font-style: italic;'>Italic</span> Font Style<br>"

    'Provide Bold Style
    BodyContent = BodyContent & "Apply <span Style = 'Font-weight: Bold;'>bold</span> on Font<br>"

    'Provide Bolder Style
    BodyContent = BodyContent & "Apply <span Style = 'Font-weight: Bolder;'>bolder</span> on Font<br>"

    'Increase Font Weight
    BodyContent = BodyContent & "Apply Bold <span Style = 'Font-weight: 900;'>upto 900</span> on Font<br>"

    BodyContent = BodyContent & "<br>Thanks,<br>Pavan Kumar</p>"

    With M
    .To = "Enter Your Email id"
    .CC = "Enter Your Email id"
    .BCC = "Enter Your Email Id"
    .Subject = "This Is about Span Tag"
    .BodyFormat = olFormatHTML
    .HTMLBody = BodyContent & .HTMLBody
    .Display
    '.Send
    End With
    End Sub