I am writing a VBScript for one of my clients to auto generate their email signature. Everything works great, except for on caveat.

There is a line in the signature so users can add their mobile phones. However, not all users will need to add their mobile phone. So if the mobile field is left blank, it will create a blank line in their email signature.

I know its not the end of the world, but I can't figure out how to get it to check the LDAP mobile phone field, and if its blank, to skip this field.

Here is a copy of the script I am putting together...

[script]
Set objUser = CreateObject("WScript.Network")
userName = objUser.UserName
domainName = objUser.UserDomain

FUNCTION GetUserDN(BYVAL UN, BYVAL DN)
Set ObjTrans = CreateObject("NameTranslate")
objTrans.init 1, DN
objTrans.set 3, DN & "\" & UN
strUserDN = objTrans.Get(1)
GetUserDN = strUserDN
END FUNCTION

Dim objFSO, objWsh, appDataPath, pathToCopyTo
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWsh = CreateObject("WScript.Shell")
appDataPath = objWsh.ExpandEnvironmentStrings("%APPDATA%")
pathToCopyTo = appDataPath & "\Microsoft\Signatures\"
Set objLDAPUser = GetObject("LDAP://" & GetUserDN(userName,domainName))
Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.Font.Name = "Arial"
objSelection.Font.Bold = True
objSelection.Font.Size = "9.5"
objSelection.TypeText(objLDAPUser.DisplayName)
objSelection.TypeParagraph()
objSelection.Font.Size = "9.5"
objSelection.Font.Bold = False
objSelection.TypeText(objLDAPUser.title)
objSelection.TypeParagraph()
objSelection.Font.Size = "10"
objSelection.Font.Bold = True
objSelection.TypeText(objLDAPUser.company)
objSelection.TypeParagraph()
objSelection.Font.Name = "Century Gothic"
objSelection.Font.Size = "9.5"
objSelection.Font.Bold = False
objSelection.TypeText("t: " & objLDAPUser.telephoneNumber)
objSelection.TypeText(" ext. " & objLDAPUser.homephone)
objSelection.TypeParagraph()
objSelection.TypeText("f: " & objLDAPUser.facsimiletelephoneNumber)
objSelection.TypeParagraph()

objSelection.TypeText("" & objLDAPUser.mobile)
objSelection.TypeParagraph()


objSelection.Font.Name = "Arial"
objSelection.Font.Bold = False
objSelection.Font.Size = "9.5"
objSelection.TypeText("e: ")
objSelection.Hyperlinks.Add objSelection.range, objLDAPUser.mail
objSelection.TypeParagraph()
objSelection.TypeText("w: ")
objSelection.Hyperlinks.Add objSelection.range, objLDAPUser.WWWHomepage
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.Font.Name = "Arial"
objSelection.Font.Bold = False
objSelection.Font.Size = "11"
objSelection.TypeText("Strategically Engineering our Client's Vision")
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.Font.Name = "Century Gothic"
objSelection.Font.Bold = False
objSelection.Font.Size = "9"
objSelection.TypeText("E-MAIL CONFIDENTIALITY NOTICE: The contents of this e-mail message and any attachments are intended solely for the addressee(s) and may contain confidential and/or legally privileged information. If you are not the intended recipient of this message or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message and any attachments. If you are not the intended recipient, you are notified that any use, dissemination, distribution, copying, or storage of this message or any attachment is strictly prohibited.")
objSelection.TypeParagraph()

objDoc.SaveAs(appDataPath & "\Microsoft\Signatures\default.rtf")
objWord.Quit
[/script]

Thanks