![]() |
#4
|
||||
|
||||
![]()
Try the following macro.
Code:
Sub ReLinkEndNotes() Dim i As Long, j As Long, NtRng As Range, Rng As Range, StrNt As String Application.ScreenUpdating = False With ActiveDocument Set NtRng = Selection.Range Set Rng = .Range Rng.End = NtRng.Start With NtRng .ListFormat.ConvertNumbersToText .Style = "Endnote Text" With .Find .ClearFormatting .Text = "([0-9]{1,}).^t" With .Replacement .ClearFormatting .Text = "\1 " End With .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With For i = 1 To .Paragraphs.Count If IsNumeric(Trim(.Paragraphs(i).Range.Words(1))) Then With .Paragraphs(i).Range j = Trim(.Words(1)) StatusBar = "Creating Endnote: " & j .Start = .Start + Len(j) .End = .End - 1 StrNt = .Text .Delete End With With Rng.Find .Text = j .Format = True .Font.ColorIndex = wdRed .MatchWholeWord = True .MatchWildcards = False .Execute If .Found = True Then .Parent.Select With Selection .Text = vbNullString .Endnotes.Add Range:=Selection.Range, Text:=StrNt End With Rng.Start = .Parent.Start End If End With End If Next i .Delete End With End With Set NtRng = Nothing: Set Rng = Nothing Application.ScreenUpdating = True End Sub For PC macro installation & usage instructions, see: Installing Macros For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
endnotes |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
kenglade | Word | 22 | 09-14-2012 04:10 PM |
![]() |
elias | Word | 12 | 09-04-2012 04:12 PM |
![]() |
Boatwrenchv8 | Word | 3 | 05-17-2012 04:56 PM |
combining word documents with endnotes | mikelee114 | Word | 1 | 04-08-2012 05:27 AM |
![]() |
Brent | Word | 5 | 02-01-2011 03:15 PM |