Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 500
  • Last Modified:

HTML format problem

Hello
I am writing a script that reads my active directory and then from the information received create a auto signature in outlook. My problem is the formatting . As soon as I try to make one line bold using the tag <b> the whole signature font is the 'bolded"
How can I rectify this?

code:

'==========================================================================
' Read User's Active Directory information
'==========================================================================
   Dim objSysInfo, objUser

   Set objSysInfo = CreateObject("ADSystemInfo")
   Set objUser    = GetObject("LDAP://" & objSysInfo.Username)

   strFullName = objUser.Firstname
   strFullName1 = objUser.Lastname
   strTitle    = objUser.title
   strEmail    = objuser.emailaddress
   strOffice    = objuser.Office
   strTel    = objuser.telephoneNumber
   strDepartment = objUser.Department
   strDescrip = objUser.Descrip
   strAddr1 = objUser.streetaddress
   strFax = objUser.facsimileTelephonenumber
   strMobile = objUser.Mobile
   strPostBox = objUser.postOfficeBox
   strTown = objUser.l
   strPostCode = objUser.PostalCode

   If Trim(strTitle) = "" Then strTitle = "_"
   If Trim(strEmail) = "" Then strEmail = strCorpEmail

   Set objUser    = Nothing
   Set objSysInfo = Nothing


'==========================================================================
' Get Signature Folder
'==========================================================================
   Dim objShell
   Set objShell = CreateObject("WScript.Shell")
   strSigFolder = ObjShell.ExpandEnvironmentStrings("%appdata%") & "\Microsoft\Signatures\"
   Set objShell = Nothing


'==========================================================================
' Get Signature Folder
'==========================================================================
   Dim objFSO, objFile
   Set objFSO   = CreateObject("Scripting.FileSystemObject")

   If Not (objFSO.FolderExists(strSigFolder)) Then
      Call objFSO.CreateFolder(strSigFolder)
   End If

   strHTMFile = strSigFolder & strSigName & ".htm"
   strRTFFile = strSigFolder & strSigName & ".rtf"
   strTXTFile = strSigFolder & strSigName & ".txt"


'==========================================================================
' Create HTM File
'==========================================================================
'chr(47) = /

   Err.Clear
   Set objFile = objFSO.CreateTextFile(strHTMFile, boolUpdateStyle, False)
   If Err.Number = 0 Then
      'objFile.Write "<html> <head> <Firstname> <" & Chr(47) & "Lastname> <" & Chr(47) & "head> <body>"&vbCrLf
      objFile.Write "<p><span style=""FONT-SIZE: 9pt; COLOR:black; FONT-FAMILY: Arial"">"&vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-US"">Best Regards<o:p></o:p></span><br/> "& vbCrLf
      objFile.Write "<b><span lang=EN-US style=""font-size:11.0pt;font-family:Arial;mso-ansi-language:EN-US"">" & strFullName & " " & strFullName1 & "</span><b/><br/> "
      'objFile.Write strFullName & " " & strFullname1 & "<br />"&vbCrLf
      'objFile.Write strFullName1 & "<br />"&vbCrLf
      'objFile.Write strDepartment & "<br />"&vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:9.0pt;font-family:Arial;mso-ansi-language:EN-US"">" & strTitle & " / " &strDepartment & "</span><br/> "& vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:11.0pt;font-family:Arial;mso-ansi-language:EN-US"">" & strCompany & "</span><br/> "& vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:9.0pt;font-family:Arial;mso-ansi-language:EN-US"">" & strPostBox & "</span><br/> "& vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:9.0pt;font-family:Arial;mso-ansi-language:EN-US"">" & strAddr1 & "</span><br/> "& vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:9.0pt;font-family:Arial;mso-ansi-language:EN-US"">" & strTown & " " &strPostCode & "</span><br/> "& vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:9.0pt;font-family:Arial;mso-ansi-language:EN-US"">Tel:    &nbsp;" & strTel & "</span><br/> "& vbCrLf
        objFile.Write "<span lang=EN-US style=""font-size:9.0pt;font-family:Arial;mso-ansi-language:EN-US"">Fax:    &nbsp;" & strFax & "</span><br/> "& vbCrLf
      objFile.Write "<span lang=EN-US style=""font-size:9.0pt;font-family:Arial;mso-ansi-language:EN-US"">Mobile:&nbsp;" & strMobile & "</span><br/> "& vbCrLf
      objFile.Write "E-Mail:&nbsp;<a href=""mailto: " & strEmail & """ style=""FONT-SIZE: 9pt; COLOR:#1F497D; FONT-FAMILY: Arial"""
      objFile.Write ">" & strEmail & "<" & Chr(47) & "a><br />"&vbCrLf
     objFile.Write "Internet: &nbsp; <a href=""" &strWeb & """ style=""FONT-SIZE: 9pt; COLOR:#1F497D; FONT-FAMILY: Arial"""
      objFile.Write ">" & strWeb & "<" & Chr(47) & "a>"&vbCrLf
      objFile.Write "<" & Chr(47) & "p>"&vbCrLf
0
Doringdraad
Asked:
Doringdraad
1 Solution
 
BardobraveCommented:
In this line you have wrongly closed the <b> tag.

objFile.Write "<b><span lang=EN-US style=""font-size:11.0pt;font-family:Arial;mso-ansi-language:EN-US"">" & strFullName & " " & strFullName1 & "</span><b/><br/> "

You should use </b> instead of <b/>
0
 
worthyking1Commented:
Your close bold tag is wrong. it should be </b> and not <b/>
0
 
DoringdraadAuthor Commented:
a stupid mistake from my side. but thanks for the response
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now