April 19, 201115 yr Hi, I am looking for some help with a VB script I am trying to improve.The script runs at logon and pulls out some AD information to create an email signature for the user in Outlook 2003. The script is working fine but I would now like to add in a check so if a field is blank, it does not include that section the in signature.The issue is that not all users have fax numbers so I would like to check the fax and only include the lineobjSelection.TypeText "Direct Fax: " & strFaxif it is not empty.Any pointers ?Full ScriptOn Error Resume NextSet objSysInfo = CreateObject("ADSystemInfo")strUser = objSysInfo.UserNameSet objUser = GetObject("LDAP://" & strUser)strName = objUser.FullNamestrTitle = objUser.TitlestrDepartment = objUser.DepartmentstrCompany = objUser.CompanystrPhone = objUser.telephoneNumberstrFax = objUser.facsimileTelephoneNumberSet objWord = CreateObject("Word.Application")Set objDoc = objWord.Documents.Add()Set objSelection = objWord.SelectionSet objEmailOptions = objWord.EmailOptionsSet objSignatureObject = objEmailOptions.EmailSignatureSet objSignatureEntries = objSignatureObject.EmailSignatureEntriesobjSelection.Font.Name = "Arial"objSelection.Font.Size = "10"objSelection.Font.Bold = TrueobjSelection.TypeParagraph()objSelection.TypeText strNameobjSelection.TypeParagraph()objSelection.TypeText strTitleobjSelection.TypeParagraph()objSelection.TypeText "Direct Dial: " & strPhoneobjSelection.TypeParagraph()objSelection.TypeText "Direct Fax: " & strFaxSet objSelection = objDoc.Range()objSignatureEntries.Add "AD Signature", objSelectionobjSignatureObject.NewMessageSignature = "AD Signature"objSignatureObject.ReplyMessageSignature = "AD Signature"objDoc.Saved = TrueobjWord.Quit
April 19, 201115 yr Try addng This Code Before strFax Is Outputted If strFax = "" Then strFax = "No User Fax Number Was Found" Else strFax = strFax End If objSelection.TypeText "Direct Fax: " & strFax
April 20, 201115 yr .....objSelection.TypeParagraph()if strFax <> "" then objSelection.TypeText "Direct Fax: " & strFaxEnd IfSet objSelection = objDoc.Range()......
Create an account or sign in to comment