We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How to create hyperlink inside this signature file creation script?

blhess
blhess asked
on
Medium Priority
681 Views
Last Modified: 2013-11-05
Hey All,

I have a signature file that I would like to add hyperlinks to...Basically the script creates txt, rtf, and html signature files and sets them as the default.  i am just having trouble coding in the hyperlinks.

The first are the two web addresses and the last one is the email address.  Any thoughts the best way to do this?
On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")

Set WshShell = CreateObject("WScript.Shell")

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

strName = objUser.FullName
strTitle = objUser.Description
strCred = objUser.info
strStreet = objUser.StreetAddress
strLocation = objUser.l
strPostCode = objUser.PostalCode
strPhone = objUser.TelephoneNumber
strMobile = objUser.Mobile
strFax = objUser.FacsimileTelephoneNumber
strEmail = 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.Font.Name = "calibri"
objSelection.Font.Size = 10
objSelection.TypeText "If you have any other questions about this, or need any further assistance, please do not hesitate to email or call."
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
objSelection.TypeText "Thank you,"
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
if (strCred) Then objSelection.TypeText strName & ", "
objSelection.TypeText Chr(11)
objSelection.TypeText strTitle
objSelection.TypeText Chr(11)
objSelection.TypeText "MCITP Enterprise Admin |MCTS|MCSA – Sec |MCSE – Sec |MCP|CompTIA A+, Net+ & Sec+ Certified"
objSelection.TypeText Chr(11)
objSelection.TypeText "COMPANY NAME GOES HERE"
objSelection.TypeText Chr(11)
objSelection.TypeText "ADDRESS GOES HERE"
objSelection.TypeText Chr(11)
objSelection.TypeText "555.555.5555 "
objSelection.TypeText "x" & strPhone
objSelection.TypeText Chr(11)
objSelection.TypeText "http://www.google.com  http://www.facebook.com"
Set objSelection = objDoc.Range()

objSignatureEntries.Add "Full Signature", objSelection
objSignatureObject.NewMessageSignature = "Full Signature"

objDoc.Saved = True
objWord.Quit

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.Font.Name = "Arial"
objSelection.Font.Size = 10
objSelection.TypeText "If you have any other questions about this, or need any further assistance, please do not hesitate to email or call."
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
objSelection.TypeText "Thank you,"
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
if (strCred) Then objSelection.TypeText strName & ", "
objSelection.TypeText Chr(11)
objSelection.TypeText strTitle
objSelection.TypeText Chr(11)
objSelection.TypeText "COMPANY NAME"
objSelection.TypeText Chr(11)
objSelection.TypeText "555.555.5555 "
objSelection.TypeText "x" & strPhone


Set objSelection = objDoc.Range()

objSignatureEntries.Add "Reply Signature", objSelection

objSignatureObject.ReplyMessageSignature = "Reply Signature"

objDoc.Saved = True
objWord.Quit

Open in new window

Comment
Watch Question

Commented:
I have the same script and I tried for a long time to get it to do the exact same thing... with no luck.

However I can advise you that if you remove or comment-out lines 59 and 61 the script runs faster, otherwise the script is unnecessarily quitting Word and recreating another Word object.
blhessDirector of IT

Author

Commented:
Thanks for the cleanup tip.  Yes hopefully you and i both can get some help adding in a link.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
blhessDirector of IT

Author

Commented:
Thanks!  Worked like a charm!
If my solution worked, why are you requesting this question to be closed accepting your comment?

If my solution worked, you should accept my comment as the solution.

Please let me know your response.

Thanks,

Commented:
I obviously didn't try hard enough!

I'm objecting to your chosen solution, blhess, only because I assume you accidentally accepted the wrong comment (instead of rlandquist's) as the answer... otherwise that would be awfully mean of you :)

Commented:
Thanks rlandquist this is great!

Do you know how I would change the font of the hyperlink to Arial? Assuming that's possible?
blhessDirector of IT

Author

Commented:
AWESOME!  Thanks  Worked like a charm
Thanks for fixing the accepted comment, and the grade! ;-)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.