#1
|
|||
|
|||
Converting hyperlinked endnotes to footnotes
Hello,
I have a .doc document in which the endnotes are hyperlinks, I suspect, because the .doc has been generated from an html webpage. I am trying to find a way to convert these to footnotes for further processing (but I know how to do that). I have tried this solution Convert hyperlinks into footnotes on StackOverflow However, it it does not work on this file, I suspect, because this might be indeed a different scenario. I am attaching a sample document which should explain what the problem is. Thank you very much! My apologies, I posted in the wrong forum by mistake: I would be grateful if the thread could be moved. Thanks. |
#2
|
|||
|
|||
These are not Word endnotes. Word does not see them as endnotes at all. They were apparently prepared in a different program (perhaps Endnote?). Word does not have an automatic way of converting these. The source program might.
The hyperlinks refer back to places in the document. It is possible that someone here will be able to give you a macro that converts these. I believe it to be beyond my skill level. Otherwise, I would recommend doing it manually. Copy the content of each endnote into the clipboard. Then use the hyperlink to go to the source and insert a footnote, copying the old content. Then delete both the endnote reference in the text and the endnote. |
#3
|
|||
|
|||
Thanks! I appreciate your help with this. Unfortunately, I have 800+ documents where I would have to do this, so doing it manually might be a bit of a no go. I will have to figure out a way to deal with this with code, I suspect, although I now understand why the original vba solution I relied on did not work on this one.
Thanks again! |
#4
|
||||
|
||||
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thanks! And sorry, I should have been clearer. My ultimate goal is to convert the endnotes into footnotes and then the footnotes into inline citations (but I do have some code—actually, *your* code!) to perform that task. But I do also find it useful to have a version of the document with actual footnotes so my goal would have been to process the files twice (once for the conversion to footnotes and once to get them into inline citations). Does this clarify the problem? Thanks again!
|
#6
|
||||
|
||||
Try the following code. Although you refer to footnotes, your content is more akin to endnotes - which is what the macro converts your content to.
Code:
Sub CreateEndNotes() Application.ScreenUpdating = False Dim Tbl As Table, r As Long, Hlnk As Hyperlink Dim RngRef As Range, RngText As Range With ActiveDocument .Endnotes.NumberStyle = wdNoteNumberStyleArabic Set Tbl = .Hyperlinks(.Hyperlinks.Count).Range.Tables(1) If Tbl Is Nothing Then Exit Sub With Tbl For r = .Rows.Count To 1 Step -1 If .Cell(r, 1).Range.Hyperlinks.Count > 0 Then Set Hlnk = .Cell(r, 1).Range.Hyperlinks(1) Set RngText = Tbl.Cell(r, 2).Range With RngText .End = .End - 1 Do While .Characters.Last = vbCr .End = .End - 1 Loop End With Set RngRef = ActiveDocument.Bookmarks(Hlnk.SubAddress).Range With RngRef .End = .Paragraphs(1).Range.End .End = .Hyperlinks(1).Range.End .Text = vbNullString End With ActiveDocument.Endnotes.Add RngRef With RngRef .End = .End + 1 .Endnotes(1).Range.FormattedText = RngText.FormattedText End With End If Next .Delete End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
footnotes, hyperlinks, vba |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Converting certain footnotes to endnotes | Brainiac | Word VBA | 3 | 07-02-2019 04:31 AM |
Footnotes / Endnotes? | See attachment | modene1 | Word | 2 | 05-17-2017 02:53 AM |
Changing footnotes to endnotes | Sarah | Word | 3 | 04-27-2017 08:55 PM |
Converting hard-entered endnotes to footnotes? | New Daddy | Word VBA | 1 | 10-21-2012 02:51 PM |
Endnotes within Footnotes? | elias | Word | 12 | 09-04-2012 04:12 PM |