Specifying styles for hyperlinks
In order to customize the appearance of hyperlinks, the two styles
Hyperlink and
Followed Hyperlink can be used. They only spring in existence as soon as a hyperlink is used in a workbook (using the
=hyperlink(…)
worksheet function or the
hyperlink
object).
It is advisable, imho, to create them and define the appearance before any hyperlink is inserted.
option explicit
sub main() ' {
dim stHyperlink as style
dim stHyperlinkFollowed as style
set stHyperlink = thisWorkbook.styles.add("Hyperlink" )
set stHyperlinkfollowed = thisWorkbook.styles.add("Followed Hyperlink")
stHyperlink.font.color = rgb(5, 99, 193)
stHyperlinkFollowed.font.color = rgb(5, 99, 193)
activeSheet.cells(1,1).formula = "=hyperlink(""#b1"", ""b1"")"
activeSheet.cells(2,1).formula = "=hyperlink(""#a1"", ""a1"")"
end sub ' }