1

I'm using the citations feature in Microsoft Word and creating a list of references at the end of my document. An example of the generated reference is:

  1. USDOT. ITS Benefits Database. ITS Knowldege Resources. [Online] [Cited: 7 6, 2016.] www.itsbenefits.its.dot.gov.

Is there a way to get the url (www.itsbenefits.its.dot.gov) to be an automatically generated hyperlink, as it is when I type URLs into the main text of the document? If so, how do I do this? Right now, it doesn't even let me edit the entry to make the URL a link, and if it did, I'd lose it anytime I auto-updated the references.

I'm using Word 2013.

1 Answer 1

0

The following macro code seems to work for me:

Sub Add_Hyperlinks_Bibliography()
On Error Resume Next
Set rngSearch = Selection
For I = 1 To ActiveDocument.Bibliography.Sources.Count
 Selection.HomeKey Unit:=wdStory
 strStyle = "Intensieve benadrukking"
 strSearch = ActiveDocument.Bibliography.Sources.Item(I).Field("URL")
 strAddress = strSearch
 With rngSearch.Find
    Do While .Execute(findText:=strSearch, MatchCase:=False, MatchWholeWord:=False) = True
        With rngSearch 'we will work with what is found as it will be the selection
            ActiveDocument.Hyperlinks.Add Anchor:=rngSearch, Address:=strAddress
            .Style = ActiveDocument.Styles(strStyle) 'throw the style on it after the link
        End With
        rngSearch.Collapse Direction:=wdCollapseEnd
        'keep it moving
    Loop
 End With
Next I
On Error GoTo 0
Set rngSearch = Nothing
End Sub

Obviously, you would have to execute this code each time you refresh the bibliography-field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.