Hi All,

I have this VB code that I am trying to convert into Kix, Creates an signature in outlook.

It works up to a certain point and then bombs out and I can't understand why (mainly becuause my VB Scripting is crap).

This is the line of code, I think, where it is having the problems.
$objSignatureEntries.Add "AD Signature", $objSelection

The other minor problem I'm having is once the signature is created all of the text is spaced too far apart. I need to be able to do a "Shift Return" instead of a simple "Return" so I don't have such a large space between each line. Does anyone know how to get around this?

I've included both the VB and KIX code
Any help would be much appreciated. thanks.

 Code:
On Error Resume Next

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

strName 	= objUser.FullName
strSN 		= objUser.sn
strmobile 	= objUser.mobile
strTitle 	= objUser.Title
strDepartment 	= objUser.Department
strCompany 	= objUser.Company
strPhone 	= objUser.telephoneNumber
strGivenName 	= objUser.givenname
strMail 	= objUser.mail

Set objWord 	= CreateObject("Word.Application")

Set objDoc 	= objWord.Documents.Add()
Set objSelection = objWord.Selection

Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries

objSelection.TypeText "Kind Regards,"
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeText strGivenName & " " & strSN
objSelection.TypeParagraph()
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.TypeParagraph()
'objSelection.TypeText strDepartment
'objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText "P: " & strPhone
objSelection.TypeParagraph()
objSelection.TypeText "M: " & strmobile
objSelection.TypeParagraph()
objSelection.TypeText strmail
 
Set objSelection = objDoc.Range()

[color:#CC0000]objSignatureEntries.Add "AD Signature", objSelection[/color]
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"

objDoc.Saved = True
objWord.Quit

 Code:
 
$objSysInfo 	= CreateObject("ADSystemInfo")
$strUser 	= $objSysInfo.UserName
$objUser	= GetObject("LDAP://" + $strUser)

$strName 	= $objUser.FullName
$strSN 		= $objUser.sn
$strmobile 	= $objUser.mobile
$strTitle 	= $objUser.Title
$strDepartment  = $objUser.Department
$strCompany 	= $objUser.Company
$strPhone 	= $objUser.telephoneNumber
$strGivenName 	= $objUser.givenname
$strMail 	= $objUser.mail

$objWord 	= CreateObject("Word.Application")

$objDoc 	= $objWord.Documents.Add()
$objSelection 	= $objWord.Selection

$objEmailOptions = $objWord.EmailOptions
$objSignatureObject = $objEmailOptions.EmailSignature
$objSignatureEntries = $objSignatureObject.EmailSignatureEntries

$objSelection.TypeText "Kind Regards,"
$objSelection.TypeParagraph()
$objSelection.TypeParagraph()
$objSelection.TypeText $strGivenName + " " + $strSN
$objSelection.TypeParagraph()
$objSelection.TypeText $strTitle
$objSelection.TypeParagraph()
$objSelection.TypeParagraph()
'$objSelection.TypeText strDepartment
'$objSelection.TypeParagraph()
$objSelection.TypeText $strCompany
$objSelection.TypeParagraph()
$objSelection.TypeText "P: " + $strPhone
$objSelection.TypeParagraph()
$objSelection.TypeText "F: 07 3222 9323"
$objSelection.TypeParagraph()
$objSelection.TypeText "M: " + $strmobile
$objSelection.TypeParagraph()
$objSelection.TypeText $strmail
 
Set $objSelection = $objDoc.Range()

[color:#CC0000]$objSignatureEntries.Add "AD Signature", $objSelection[/color]
$objSignatureObject.NewMessageSignature = "AD Signature"
$objSignatureObject.ReplyMessageSignature = "AD Signature"

$objDoc.Saved = True
$objWord.Quit