Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

signature script inserting picture size, position issue

Status
Not open for further replies.

millsyboy

MIS
Jan 14, 2009
3
GB
I am trying to get a script to position and size an image correctly into a Outlook signature script. I have researched but to no success and wondered if someone could help me please?

On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strTitle = objUser.Title
strDescription = objuser.Description
strCompany = objUser.Company
strmail = objUser.mail
strlogo = "c:\logo.jpg"
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.Style = "No Spacing"
objSelection.Font.Name = "Arial"
objSelection.Font.Size = "9"
objSelection.Font.Color = "669999"

objSelection.TypeText strName
objSelection.TypeParagraph()

objSelection.Font.Name = "Arial"
objSelection.Font.Size = "9"

objSelection.Font.Bold = true
objSelection.TypeText strDescription
objSelection.Font.Bold = false

objSelection.TypeParagraph()
objSelection.Font.Name = "Arial"
objSelection.Font.Size = "9"

objSelection.Hyperlinks.Add objSelection.range, "mailto:" & strMail, , , strMail
objSelection.TypeParagraph()
objSelection.ClearFormatting()

objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeParagraph()

Set objShape = objDoc.Shapes
objShape.AddPicture(strlogo)

Set objShapeRange = objDoc.Shapes.Range(1)
objShapeRange.WrapFormat.Type = wdWrapInline

Set objSelection = objDoc.Range()
objSignatureEntries.Add "Signature", objSelection
objSignatureObject.NewMessageSignature = "Signature"
'objSignatureObject.ReplyMessageSignature = "Signature"
objDoc.Saved = True
objWord.Quit

Thanks
 
What is the problem? What doesn't it do? What does it do that it shouldn't? Do you get any errors (I doubt that you do since you have a global On Error Resume Next)? Remove the On Error Resume Next to see if you get errors.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
The script runs fine it just puts the inserted picture in the wrong place. I need it to place the picture underneath the text and hopefully some code to adjust the size of the picture (jpg).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top