Created
February 1, 2020 20:25
-
-
Save ellbur/356ed54d31d03ff32a57ef9683c7c3e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub NumberToLink() | |
Dim numStars As Integer | |
If ActiveDocument.Footnotes.Count >= 1 Then | |
If Len(ActiveDocument.Footnotes(1).Reference.Text) = 0 Then | |
numStars = 1 | |
Else | |
If Asc(ActiveDocument.Footnotes(1).Reference.Text) = 2 Then | |
numStars = 0 | |
Else | |
numStars = 1 | |
End If | |
End If | |
Else | |
numStars = 0 | |
End If | |
Dim DisplayText As String | |
Dim DisplayNumeric As Integer | |
Dim Item As String | |
DisplayText = Selection.Text | |
DisplayNumeric = Val(DisplayText) | |
Item = CStr(DisplayNumeric + numStars) | |
Selection.InsertCrossReference ReferenceType:="Footnote", ReferenceKind:= _ | |
wdFootnoteNumber, ReferenceItem:=Item, InsertAsHyperlink:=True, _ | |
IncludePosition:=False, SeparateNumbers:=False, SeparatorString:=" " | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment