#185794 - 2008-02-28 12:09 PM
hyperlink in my outlook signature
|
graesdal
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
; 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
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:
$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
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_
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:
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_
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:
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
|
|
|
|
#194459 - 2009-06-26 07:52 AM
Re: hyperlink in my outlook signature
[Re: NTDOC]
|
graesdal
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
|
|
|
|
#194493 - 2009-06-29 08:00 AM
Re: hyperlink in my outlook signature
[Re: Mart]
|
graesdal
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
Fresh Scripter
Registered: 2003-04-10
Posts: 35
Loc: Ornbau, Frankonia, Germany
|
I don't understand the problem!
Why not the easy way:
<a href="&WEBURL&">&WEBURL&</a><br>
|
|
Top
|
|
|
|
#202962 - 2011-08-24 04:09 AM
Re: hyperlink in my outlook signature
[Re: Mart]
|
WDTL
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 -
$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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|