I'm trying to make a macro to add hyperlinks with different styles depending on level, each link on a new row in a table.
hyperlinktext1 (sub style1) (i.e bold and size 16)
1.1 hyperlinktext2 (sub style2) (i.e size 14)
I have made sure that the styles exist and work for normal text but I can't get it to work with applying a style to a hyperlink added with VBA.
Changing styles works on hyperlinks I manually add for some reason.
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"file.pdf", SubAddress:="", ScreenTip:="", TextToDisplay:="text1"
Selection.Style = ActiveDocument.Styles("Sub level1")
'new row
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.InsertRows 1
Selection.Collapse Direction:=wdCollapseStart
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"file2.pdf", SubAddress:="", ScreenTip:="", TextToDisplay:="text2"
Selection.Style = ActiveDocument.Styles("Sub level2")
Any suggestions?