$fontname = "Arial"
$fontmedium = "8"
;Font colour codes can be found by recording a macro in Word while setting the colour for some text.
$fontgray = "5855577" ;Gray RGB: 89.89.89
;Insert and select hyperlink and set font and attributes for the selection.
;Calculate where the hyperlink begins.
;Start selection at total length of all text minus the length of the url and select everything to the end of the text.
$objLink = $objSelection.Hyperlinks.Add($objSelection.Range, "mailto:" + $strmail,, "E-mail", $strmail)
$Selectionemail = $objDoc.Range($objSelection.End - (Len($strmail) + 1), $objSelection.End)
;Set font, size and underline for selection.
$Selectionemail.Font.Name = $fontname
$Selectionemail.Font.Size = $fontmedium
$Selectionemail.Font.Underline = 0
$Selectionemail.Font.Color = $fontgray