Page 1 of 1 1
Topic Options
#185794 - 2008-02-28 12:09 PM hyperlink in my outlook signature
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
i want to make the two lines hyberlinks

$objSelection.TypeText("E-mail:mail@@mail.dk")
$objSelection.TypeText("www.myhomepage.dk")

can anyone help me
i have tryed reading this http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1447566&SiteID=1 but i cant seem to get i working

 Code:
 ; COPY OUTLOOK SIGNATURE

$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
$strOffice	= $objuser.Office


$objWord 	= CreateObject("Word.Application")

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

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


$objSelection.Font.name="Arial"
$objSelection.Font.size="8"
$objSelection.Font.Color = "8388608"
$objSelection.TypeText("Med venlig Hilsen,")
$objSelection.TypeParagraph()
$objSelection.TypeParagraph()
$objSelection.Font.bold = "1"
$objSelection.TypeText($strGivenName + " " + $strSN)
$objSelection.Font.bold = "0"
$objSelection.Font.name="Arial"
$objSelection.TypeParagraph()
$objSelection.TypeText($strTitle)
$objSelection.TypeParagraph()
$objSelection.TypeText("E-mail: " + $strmail)
$objSelection.TypeParagraph()
$objSelection.TypeParagraph()
$objSelection.Font.size="10"
$objSelection.Font.bold = "1"
$objSelection.TypeText($strCompany)
$objSelection.Font.bold = "0"
$objSelection.Font.size="8"
$objSelection.TypeParagraph()
$objSelection.TypeText("xxxxxxxxxxxxx")
$objSelection.TypeParagraph()
$objSelection.TypeParagraph()
$objSelection.TypeText("xxxxxxxxxxxxxxxxxx")
$objSelection.TypeParagraph()
$objSelection.TypeParagraph()
$objSelection.TypeText("xxxxxxxxxx + $strPhone)
$objSelection.TypeParagraph()
$objSelection.TypeText("Mobil Nummer: " + $strmobile)
$objSelection.TypeParagraph()
$objSelection.TypeText("Fax: xxxxxxxxxxxx")
$objSelection.TypeParagraph()
$objSelection.TypeText("E-mail:mail@@mail.dk")
$objSelection.TypeParagraph()
$objSelection.TypeText("www.myhomepage.dk")

$objSelection = $objDoc.Range()
$DISCARD=$objSignatureEntries.Add("xxxxxxxxx Signatur", $objSelection)
$objSignatureObject.NewMessageSignature = "xxxxxxxxx Signatur"
$objSignatureObject.ReplyMessageSignature = "xxxxxxxxxx Signatur"

$objDoc.Saved = 1
$objWord.Quit

Top
#185812 - 2008-02-28 06:40 PM Re: hyperlink in my outlook signature [Re: graesdal]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Nice code.
But if you see something goes wrong, trying to catch the error can do miracles:
 Code:
$Catch = $objselection.Hyperlinks.add($objSelection.Range,"http://test","","","http://test","")
If @ERROR
	? @ERROR ": " @SERROR
EndIf

Top
#185819 - 2008-02-29 07:41 AM Re: hyperlink in my outlook signature [Re: Witto]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
thanks but i really need to make hyperlinks
Top
#185823 - 2008-02-29 11:27 AM Re: hyperlink in my outlook signature [Re: graesdal]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Witto just gave you the code to write a HyperLink, here's is it in Short:
 Code:
Dim $objWord, $objDoc, $objSelection, $objLink
$objWord = CreateObject("Word.Application")
$objWord.Visible = 0
$objDoc = $objWord.Documents.Add
$objSelection = $objWord.Selection
$objSelection.TypeText(@SITE)
$objSelection.TypeParagraph
$objLink = $objSelection.Hyperlinks.Add($objSelection.Range,"http://www.google.nl",, "Google", "Google Home Page")
$objSelection.TypeParagraph
$objDoc.SaveAs("C:\test.doc")
$objDoc.Close
$objWord.Application.Quit
$objWord = ""

Top
#185824 - 2008-02-29 11:58 AM Re: hyperlink in my outlook signature [Re: Arend_]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Here is the same one but added Email link as well, in case you were wondering:
 Code:
Dim $objWord, $objDoc, $objSelection, $objLink
$objWord = CreateObject("Word.Application")
$objWord.Visible = 0
$objDoc = $objWord.Documents.Add
$objSelection = $objWord.Selection
$objLink = $objSelection.Hyperlinks.Add($objSelection.Range,"http://www.google.nl",,"Google Home Page", "Google Link")
$objSelection.TypeParagraph
$objSelection.TypeParagraph
$objLink = $objSelection.Hyperlinks.Add($objSelection.Range,"mailto:mail@@gmail.com",,"Google E-mail", "Google E-Mail")
$objDoc.SaveAs("C:\test.doc")
$objDoc.Close
$objWord.Application.Quit
$objWord = ""

Top
#185839 - 2008-02-29 07:06 PM Re: hyperlink in my outlook signature [Re: Arend_]
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Thanks Arend and Witto

Will have to tuck this away with the other one you did Witto so when I get time from all these other dang fires I can look at setting these up for my environment.

Top
#194459 - 2009-06-26 07:52 AM Re: hyperlink in my outlook signature [Re: NTDOC]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
thanks for helping out im working on my script again but i have one small problem the font size in my signature is 8 but the hyperlinks is font size 11 how do i make my hyperlinks font size smaller
Top
#194461 - 2009-06-26 10:10 AM Re: hyperlink in my outlook signature [Re: graesdal]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Setting the font size just before creating the hyperlink does not work?

 Code:
$objSelection.Font.size="8"
;hyperlink code goes here
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#194493 - 2009-06-29 08:00 AM Re: hyperlink in my outlook signature [Re: Mart]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
no the font size of the link still comes out size 11
Top
#197650 - 2010-02-03 05:45 PM Re: hyperlink in my outlook signature [Re: graesdal]
Christof Offline
Fresh Scripter

Registered: 2003-04-10
Posts: 35
Loc: Ornbau, Frankonia, Germany
I don't understand the problem!

Why not the easy way:
 Code:
<a href="&WEBURL&">&WEBURL&</a><br>

Top
#197665 - 2010-02-04 09:14 AM Re: hyperlink in my outlook signature [Re: Christof]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
That does not set the font size for hyperlinks. The code Witto and Arend posted creates hyperlinks just fine.

Hyperlinks font size seems to be controlled by the stylesheet set in the stationery that holds the new mail template.

If you just insert it as text it will be a hyperlink when the recipient opens it in a mail app that support HTML messages.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202962 - 2011-08-24 04:09 AM Re: hyperlink in my outlook signature [Re: Mart]
WDTL Offline
Just in Town

Registered: 2011-08-23
Posts: 1
Loc: NZ
Hi all

Old thread but I wanted to share this. Hyperlink font can be set. Add another line after the hyperlink code.
Result should be -
 Code:
$objLink = $objSelection.Hyperlinks.Add($objSelection.Range,"http://www.google.nl",,"Google Home Page", "Google Link")
$objLink.Range.Font.Size = "8"

Taken from this link -
http://social.technet.microsoft.com/Forums/en-IN/ITCG/thread/9109b370-eb13-4a64-bf3b-1b91ccfa49ce

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.069 seconds in which 0.031 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org