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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBscript to create Outlook signature

Status
Not open for further replies.

DVHITMAN

Technical User
Jun 19, 2013
12
GB
Hello,

I'm writing a script that will run every time users login that creates a email signature for the Active Directory Data and then sets this signature as default.
This part is working great, but the problem I have is I need to insert a graphic in a particular location in the signature.

I have use "Hi, Scripting Guys" code of :-

Const wdShapeRight = -999996
Const wdWrapSquare = 0

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()

Set objShape = objDoc.Shapes
objShape.AddPicture("C:\Scripts\Welder-small.jpg")

Set objShapeRange = objDoc.Shapes.Range(1)
objShapeRange.Left = wdShapeRight

objShapeRange.WrapFormat.Type = wdWrapSquare

( )

and tweaked the code to right align, which, again, works, But its sitting at the top right of the email signature and I need it to sit at the bottom right of the signature, in line with the last line of text in the signature and above the horizontal line I have going across it.

If tried seting up

ObjShapeRange.Top = any value

but it doesn't seem to affect the images vertical position at all.

Please can someone help me ?

thanks
 
Hi GEATES, Thank for the reply... but it didnlt work for me.

The code I have to put the image in its place is

objShape.AddPicture("Set objShapeRange = objDoc.Shapes.Range(1)
objShapeRange.Left = wdShapeRight
objShapeRange.RelativeVerticalPosition = 1
objShapeRange.WrapFormat.Type = wdWrapSquare
objselection.TypeText Chr(11)
objSelection.InlineShapes.AddHorizontalLineStandard

Thanks
 
hi,

its set further up in the script in the section that setsup the word templates


' ########### Sets up word template
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
[highlight #FCE94F]Set objSelection = objWord.Selection[/highlight]
objSelection.Style = "No Spacing"
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
Set objShape = objDoc.Shapes
 
just and FYI: I've dumped the adding it as a shape approach, and I've just added a new paragraph at the end, right align it, then added the image in.
I've then align the paragraph back.

Thank again for you help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top