Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-10-2015, 02:54 AM
haryo haryo is offline Endnote links only work once then fail. Windows 8 Endnote links only work once then fail. Office 2013
Novice
Endnote links only work once then fail.
 
Join Date: Dec 2015
Posts: 3
haryo is on a distinguished road
Default Endnote links only work once then fail.


Hello All. My first post here. My question is behalf of someone else who is at their wits end with a problem with endnote hyperlinks. She has done this in previous similar documents (a quarterly Journal of articles), but the usual method is failing her. She makes a endnote hyperlink to the footnote, and it works fine. Clicking on the link takes you to the endnote at the end of the particular article, and the back arrow returns you to the text. However, you can only do that once. If you try it again, the hyperlink is gone--nothing happens, it's black and not blue. Any suggestions? We are using Word 2013 with Windows 8.1. Thank you.
Reply With Quote
  #2  
Old 12-10-2015, 03:00 AM
macropod's Avatar
macropod macropod is online now Endnote links only work once then fail. Windows 7 64bit Endnote links only work once then fail. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Since endnote references in Word automatically hyperlink to the endnotes without the addition of hyperlinks, I'm not sure what the point of adding hyperlinks is.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-10-2015, 03:41 AM
haryo haryo is offline Endnote links only work once then fail. Windows 8 Endnote links only work once then fail. Office 2013
Novice
Endnote links only work once then fail.
 
Join Date: Dec 2015
Posts: 3
haryo is on a distinguished road
Default

The Word document will ultimately be the source for a MOBI ebook file. Does that make sense of the question then?
Reply With Quote
  #4  
Old 12-10-2015, 04:57 AM
macropod's Avatar
macropod macropod is online now Endnote links only work once then fail. Windows 7 64bit Endnote links only work once then fail. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

The following macro replicates the endnote & footnote references (which become hidden text) with bookmarked hyperlinks. The second macro (KillEndNoteFootNoteHyperLinks) reverses the process.

Word's Note References always point to the reference in the body of the document, not to the endnote or footnote itself. The following HyperlinkEndNotesFootNotes macro doesn't change that behaviour. To have the Note References hyperlink to the actual endnote or footnote you could use the third macro (HLnkNoteRefs). The fourth macro (KillHLnkNoteRefs) reverses the process
Code:
Sub HyperlinkEndNotesFootNotes()
Dim SBar As Boolean           ' Status Bar flag
Dim TrkStatus As Boolean      ' Track Changes flag
Dim Rng1 As Range, Rng2 As Range, StrRef As String, i As Long
' Store current Status Bar status, then switch on
SBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
' Store current Track Changes status, then switch off
With ActiveDocument
  TrkStatus = .TrackRevisions
  .TrackRevisions = False
End With
' Turn Off Screen Updating
Application.ScreenUpdating = False
With ActiveDocument
 'Process all endnotes
  For i = 1 To .Endnotes.Count
    'Update the statusbar
    StatusBar = "Processing Endnote " & i
    'Define two ranges: one to the endnote reference the other to the endnote content
    Set Rng1 = .Endnotes(i).Reference
    Set Rng2 = .Endnotes(i).Range.Paragraphs.First.Range
    With Rng1
      'Format the endnote reference as hidden text
      .Font.Hidden = True
      'Insert a number before the endnote reference and bookmark it
      .Collapse wdCollapseStart
      'To get the actual reference text, we need to cross-reference it!
      .InsertCrossReference wdRefTypeEndnote, wdEndnoteNumber, i, False, False
      .End = .End + 1
      StrRef = .Fields(1).Result
      .Fields(1).Delete
      .Text = StrRef
      .Style = "Endnote Reference"
      .Bookmarks.Add Name:="_ERef" & i, Range:=Rng1
    End With
    'Insert a number before the endnote content and bookmark it
    With Rng2
      'Format the endnote reference as hidden text
      With .Words.First
        If .Characters.Last Like "[ " & vbTab & "]" Then .End = .End - 1
        .Font.Hidden = True
      End With
      'Insert a number before the endnote reference and bookmark it
      .Collapse wdCollapseStart
      .Text = StrRef
      .Style = " Endnote Reference"
      .Bookmarks.Add Name:="_ENum" & i, Range:=Rng2
    End With
    'Insert hyperlinks between the endnote references
    .Hyperlinks.Add Anchor:=Rng1, SubAddress:="_ENum" & i
    .Hyperlinks.Add Anchor:=Rng2, SubAddress:="_ERef" & i
    'Restore the Rng1 endnote reference bookmark
    .Bookmarks.Add Name:="_ERef" & i, Range:=Rng1
  Next
    'Give Word a chance to do its housekeeping
    DoEvents
  'Process all footnotes
  For i = 1 To .Footnotes.Count
    'Update the statusbar
    StatusBar = "Processing Footnote " & i
    'Define two ranges: one to the footnote reference the other to the footnote content
    Set Rng1 = .Footnotes(i).Reference
    Set Rng2 = .Footnotes(i).Range.Paragraphs.First.Range
    With Rng1
      'Format the footnote reference as hidden text
      .Font.Hidden = True
      'Insert a number before the footnote reference and bookmark it
      .Collapse wdCollapseStart
      'To get the actual reference text, we need to cross-reference it!
      .InsertCrossReference wdRefTypeFootnote, wdFootnoteNumber, i, False, False
      .End = .End + 1
      StrRef = .Fields(1).Result
      .Fields(1).Delete
      .Text = StrRef
      .Text = i
      .Style = "Footnote Reference"
      .Bookmarks.Add Name:="_FRef" & i, Range:=Rng1
    End With
    'Insert a number before the footnote content and bookmark it
    With Rng2
      'Format the footnote reference as hidden text
      With .Words.First
        If .Characters.Last Like "[ " & vbTab & "]" Then .End = .End - 1
        .Font.Hidden = True
      End With
      'Insert a number before the footnote reference and bookmark it
      .Collapse wdCollapseStart
      .Text = StrRef
      .Style = " Footnote Reference"
      .Bookmarks.Add Name:="_FNum" & i, Range:=Rng2
    End With
    'Insert hyperlinks between the footnote references
    .Hyperlinks.Add Anchor:=Rng1, SubAddress:="_FNum" & i
    .Hyperlinks.Add Anchor:=Rng2, SubAddress:="_FRef" & i
    'Restore the Rng1 footnote reference bookmark
    .Bookmarks.Add Name:="_FRef" & i, Range:=Rng1
  Next  
 'Update the statusbar
  StatusBar = "Finished Processing " & .Endnotes.Count & " Endnotes" & .Footnotes.Count & " Footnotes"
End With
Set Rng1 = Nothing: Set Rng2 = Nothing
' Restore original Status Bar status
Application.DisplayStatusBar = SBar
' Restore original Track Changes status
ActiveDocument.TrackRevisions = TrkStatus
' Restore Screen Updating
Application.ScreenUpdating = True
End Sub
Code:
Sub KillEndNoteFootNoteHyperLinks()
Dim SBar As Boolean           ' Status Bar flag
Dim TrkStatus As Boolean      ' Track Changes flag
Dim Rng1 As Range, Rng2 As Range, i As Long
' Store current Status Bar status, then switch on
SBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
' Store current Track Changes status, then switch off
With ActiveDocument
  TrkStatus = .TrackRevisions
  .TrackRevisions = False
End With
' Turn Off Screen Updating
Application.ScreenUpdating = False
With ActiveDocument
  'Delete endnote/footnote hyperlinks from the MainStory
  For i = .Hyperlinks.Count To 1 Step -1
    With .Hyperlinks(i)
      StatusBar = "Processing Hyperlink " & i
      If .SubAddress Like "_ENum*" Then
        .Range.Delete
      ElseIf .SubAddress Like "_FNum*" Then
        .Range.Delete
      End If
    End With
  Next i
  'Delete endnote hyperlinks from the EndnotesStory
  If .Endnotes.Count > 0 Then
    With .StoryRanges(wdEndnotesStory)
      For i = .Hyperlinks.Count To 1 Step -1
        StatusBar = "Processing Endnote Hyperlink " & i
        With .Hyperlinks(i)
          If .SubAddress Like "_ERef*" Then .Range.Delete
        End With
      Next i
    End With
  End If
  'Delete footnote hyperlinks from the FootnotesStory
  If .Footnotes.Count > 0 Then
    With .StoryRanges(wdFootnotesStory)
      For i = .Hyperlinks.Count To 1 Step -1
        StatusBar = "Processing Footnote Hyperlink " & i
        With .Hyperlinks(i)
          If .SubAddress Like "_FRef*" Then .Range.Delete
        End With
      Next i
    End With
  End If
  'Process all endnotes
  For i = 1 To .Endnotes.Count
    'Update the statusbar
    StatusBar = "Processing Endnote " & i
    'Define two ranges: one to the endnote reference the other to the endnote content
    Set Rng1 = .Endnotes(i).Reference
    Set Rng2 = .Endnotes(i).Range.Paragraphs.First.Range
    'Format the endnote reference as visible text
    Rng1.Font.Hidden = False
    Rng2.Words.First.Font.Hidden = False
  Next
  'Process all footnotes
  For i = 1 To .Footnotes.Count
    'Update the statusbar
    StatusBar = "Processing Footnote " & i
    'Define two ranges: one to the footnote reference the other to the footnote content
    Set Rng1 = .Footnotes(i).Reference
    Set Rng2 = .Footnotes(i).Range.Paragraphs.First.Range
    'Format the footnote reference as visible text
    Rng1.Font.Hidden = False
    Rng2.Words.First.Font.Hidden = False
  Next
  'Update the statusbar
  StatusBar = "Finished Processing " & .Endnotes.Count & " Endnotes" & .Footnotes.Count & " Footnotes"
End With
Set Rng1 = Nothing: Set Rng2 = Nothing
' Restore original Status Bar status
Application.DisplayStatusBar = SBar
' Restore original Track Changes status
ActiveDocument.TrackRevisions = TrkStatus
' Restore Screen Updating
Application.ScreenUpdating = True
End Sub
Code:
Sub HLnkNoteRefs()
Dim Fld As Field, StrTgt As String, Rng As Range, StrRef As String
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
For Each Fld In ActiveDocument.Fields
  With Fld
    If .Type = wdFieldNoteRef Then
      StrTgt = ActiveDocument.Bookmarks(Split(Trim(.Code), " ")(1)).Range.Characters.First.Hyperlinks(1).SubAddress
      StrRef = .Result
      Set Rng = .Code
      With Rng
        While .Fields.Count = 0
          .Start = .Start - 1
        Wend
        .Collapse wdCollapseStart
        .Hyperlinks.Add Anchor:=Rng, SubAddress:=StrTgt, TextToDisplay:=StrRef
        .End = .End + 1
        .Hyperlinks(1).Range.Font.Superscript = True
      End With
      .Result.Font.Hidden = True
    End If
  End With
Next
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
End Sub
To make this process automatic, you could insert:
Call HLnkNoteRefs
after the final:
End With
in the HyperLinkEndNoteFootNotes macro.
Code:
Sub KillHLnkNoteRefs()
Dim Fld As Field
For Each Fld In ActiveDocument.Fields
  With Fld
    If .Type = wdFieldNoteRef Then
      .Result.Font.Hidden = False
    End If
  End With
Next
End Sub
To make this process automatic, you could insert:
Call KillHLnkNoteRefs
after the final:
End With
in the KillEndNoteFootNoteHyperLinks macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 12-10-2015, 05:26 AM
haryo haryo is offline Endnote links only work once then fail. Windows 8 Endnote links only work once then fail. Office 2013
Novice
Endnote links only work once then fail.
 
Join Date: Dec 2015
Posts: 3
haryo is on a distinguished road
Default

Thank you very much. I will pass this on, being just a middleman myself. We are beginning to think it was misunderstanding the function of what I would call an 'undo' arrow.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert .DOC to PDF and retain endnote links? WaltR Word 13 08-19-2015 06:21 AM
Big presentation, links fail: solution theredspecial PowerPoint 6 08-26-2013 10:35 PM
Endnote links only work once then fail. links don't work yourforester Outlook 1 08-19-2013 09:42 AM
endnote and import reference from word to endnote uncung Word 0 06-18-2011 08:09 AM
Duration changes fail to update work effort Panteledes Project 6 05-25-2010 02:27 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 07:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft