Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2012, 08:39 AM
kenglade kenglade is offline Separating endnotes from text Mac OS X Separating endnotes from text Office for Mac 2011
Novice
Separating endnotes from text
 
Join Date: Dec 2011
Location: Rio Rancho, NM
Posts: 26
kenglade is on a distinguished road
Default Separating endnotes from text

I'm using Word 2011 with Lion. I want to separate the endnotes from the text of the chapter and put them in a separate document. Word won't let me do a Cmd-X on the endnotes. I have a macro which will do this, but when I do it screws up the chapter text. Where I have a "1" endnote it becomes "a1a" and so forth. I guess i could do a search and replace for the "a1a" but then it would become simply a "1" and not an endnote.



I can't just copy the chapter text with CMD-X because it carries the endnotes with it when I paste.

I incorrectly assumed that this would be possible Word, after all its versions, but I guess not.
Reply With Quote
  #2  
Old 01-18-2012, 04:52 PM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Moderator
 
Join Date: Aug 2011
Posts: 3,903
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

You will have to convert the endnotes to text before you can copy them into a separate document. Doug Robbins has suggested the following macro in the old Word newsgroups (I don't know if it works for MacWord, though):

Code:
Sub ConvertEndNotes()
Dim aendnote As Endnote
For Each aendnote In ActiveDocument.Endnotes
  ActiveDocument.Range.InsertAfter vbCr & _
  aendnote.Index & vbTab & _
  aendnote.Range
  aendnote.Reference.InsertBefore "a" & aendnote.Index & "a"
Next aendnote
For Each aendnote In ActiveDocument.Endnotes
  aendnote.Reference.Delete
Next aendnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
  .Superscript = True
End With
With Selection.Find
  .Text = "(a)([0-9]{1,})(a)"
  .Replacement.Text = "\2"
  .Forward = True
  .Wrap = wdFindContinue
  .Format = True
  .MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional

Last edited by macropod; 01-26-2012 at 02:50 PM. Reason: Added code tags
Reply With Quote
  #3  
Old 01-18-2012, 05:17 PM
kenglade kenglade is offline Separating endnotes from text Mac OS X Separating endnotes from text Office for Mac 2011
Novice
Separating endnotes from text
 
Join Date: Dec 2011
Location: Rio Rancho, NM
Posts: 26
kenglade is on a distinguished road
Default

Quote:
Originally Posted by Stefan Blom View Post
You will have to convert the endnotes to text before you can copy them into a separate document. Doug Robbins has suggested the following macro in the old Word newsgroups (I don't know if it works for MacWord, though)
Stefan

That macro does indeed work, but there is a problem. In the document where I have a superscript "1" at the end of the document there also is a smaller font "1." But when I run the macro, I get the following:

1 (normal size) indent Now is the time etc

At the same time, it changes the superscript "1" in the document to "a1a"

Like other things in Word for Mac, I guess it just ain't doable. But I appreciate your time.

Ken

Last edited by macropod; 01-26-2012 at 02:51 PM. Reason: Deleted quote of un-tagged code
Reply With Quote
  #4  
Old 01-18-2012, 05:19 PM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Moderator
 
Join Date: Aug 2011
Posts: 3,903
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

It might be possible to modify the macro so that it does apply superscript formatting, but I wouldn't be the right person to make that modification, I'm afraid.
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional
Reply With Quote
  #5  
Old 01-19-2012, 06:44 AM
kenglade kenglade is offline Separating endnotes from text Mac OS X Separating endnotes from text Office for Mac 2011
Novice
Separating endnotes from text
 
Join Date: Dec 2011
Location: Rio Rancho, NM
Posts: 26
kenglade is on a distinguished road
Default

Quote:
Originally Posted by Stefan Blom View Post
It might be possible to modify the macro so that it does apply superscript formatting, but I wouldn't be the right person to make that modification, I'm afraid.
Many thanks, Stefan. I really appreciate your help on this. Unfortunately, I'm not skilled enough to make the changes. I'll just devise some sort of workaround. Have decided, though, when I start another project like this I'm going to switch to Scrivener -- MS is absolutely useless in this situation -- nothing on line and nothing I can find in a web search for books on Word 2011. The one that keeps popping up by Chris Grover is remarkably deficient. If I were the publisher I'd be embarrassed.
Reply With Quote
  #6  
Old 01-26-2012, 03:39 PM
macropod's Avatar
macropod macropod is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Ken,

On a PC, if you access a footnote or endnote range and press Ctrl-A, that selectes all the footnotes or endnotes in the document. You can then use the normal copy/paste commands to replicate them in a new document. The only 'issues' with this are that:
a) you can't delete footnotes or endnotes from the original document this way; and
b) the paste footnotes or endnotes all end up numbered 1 in the new document.
A macro can easily enough address both issues:
Code:
Sub ExtractEndNotes()
Application.ScreenUpdating = False
Dim Rng As Range, i As Long, Doc As Document
With ActiveDocument
  If .Endnotes.Count = 0 Then Exit Sub
  For i = 1 To .Endnotes.Count
    Set Rng = .Endnotes(i).Reference
    With Rng
      .Collapse wdCollapseEnd
      .Text = i
      .Style = "Endnote Reference"
    End With
  Next
  .StoryRanges(wdEndnotesStory).Copy
  For i = .Endnotes.Count To 1 Step -1
  .Endnotes(i).Delete
  Next
End With
Set Doc = Documents.Add
With Doc.Range
  .Paste
  With .Find
    .ClearFormatting
    .Text = ""
    .Style = "Endnote Reference"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  End With
  Do While .Find.Found
    i = i + 1
    .Text = i
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
  .Characters.Last.Delete
End With
Set Rng = Nothing: Set Doc = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 01-27-2012, 10:43 AM
kenglade kenglade is offline Separating endnotes from text Mac OS X Separating endnotes from text Office for Mac 2011
Novice
Separating endnotes from text
 
Join Date: Dec 2011
Location: Rio Rancho, NM
Posts: 26
kenglade is on a distinguished road
Default

Hi, Paul

Many thanks for your note. Sad to say, it isn't working on my Mac. Here's what's happening. Say this is my original:

Now is the time[i]


[i] For all good men


Using a macro provided by Stefan, I can change the endnote to look like this:


Now is the time a1a
1 For all good men


I can now Cmd-X on the enddnote and move it to a separate document. But that leaves me with this in the original:


Now is the time a1a


a1a has replaced the superscript 1. I would ahve to go back through the original and change every aXa to a superscript. I have no idea how to do this and I don't think it would be productive to try. For some reason MS has decided to make it impossible to separate the endnotes from the original. Seems to me they never gave it a second thought. That's what I call half-ass work.


Saludos,
Ken








For
Reply With Quote
  #8  
Old 01-27-2012, 02:07 PM
macropod's Avatar
macropod macropod is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Ken,

You say that the macro I provided isn't working, but you don't provide any details. Instead, you tell me what Doug Robbins' code (supplied by Stefan) does - which I was already aware of. In what way isn't my macro working?

As for:
Quote:
For some reason MS has decided to make it impossible to separate the endnotes from the original. Seems to me they never gave it a second thought. That's what I call half-ass work.
I think that's a rather unfair comment. Putting endnotes into a separate document from the document to which they relate isn't exactly the kind of practice that would be considered normal. Users with such a need are rare (usually, the need is to do the opposite - convert footnote/endnote text in PDFs to real footnotes/endnotes). Even so, MS has provided tools that allow the user to automate the process.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 01-27-2012 at 03:53 PM. Reason: Correct attribution of Doug Robbins' code (supplied by Stefan)
Reply With Quote
  #9  
Old 01-27-2012, 03:03 PM
kenglade kenglade is offline Separating endnotes from text Mac OS X Separating endnotes from text Office for Mac 2011
Novice
Separating endnotes from text
 
Join Date: Dec 2011
Location: Rio Rancho, NM
Posts: 26
kenglade is on a distinguished road
Default

Sorry, I should have been more explicit. When I try it I get: "Run-time error 4605, This method of property is not available because the object spans a frame or note boundary." And then it tries to debug.

Re MS, Word bills itself as a tool for writers. I'm writing a book with about 30 chapters. Publishers don't like to publish with the end notes at the end of each chapter. What they do is move them from the end of each chapter to a document in the back of the book usually called "Chapter Notes" or just "notes." I can do this as far as the endnotes are concerned but the original document does not have the superscript number at the desired location. Rather it has "aXa" and I don't know of a way to change that back to the old superscript. If I could just remove the end notes that might help but Word won't let me do that. I'm a writer, not a computer whiz. There may be some way but I just don't understand and I can't find anything on the web to help. It seems very shortsighted on MS to allow the creation of endnotes without a way to manipulate them. Do you know how?

Saludos,
Ken
Reply With Quote
  #10  
Old 01-27-2012, 03:52 PM
macropod's Avatar
macropod macropod is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Ken,
Re:
Quote:
"Run-time error 4605, This method of property is not available because the object spans a frame or note boundary."
What code line is highlighted at that point? Can you upload a small portion of the document with sufficient content to reproduce the error? That would make debugging easier (the code worked fine for me in a document with over 100 endnotes, in blocks at the end of different chapters).

Re:
Quote:
the original document does not have the superscript number at the desired location. Rather it has "aXa" and I don't know of a way to change that back to the old superscript.
Your previous post indicated that your original document had:

Now is the time[i]

[i] For all good men

and that it was Doug Robbins' code (supplied by Stefan) that generated the "aXa" output. That code should only have left you with the "X" - superscripted where the original endnote references appeared and as plain text at the end of the document. A serious limitation (IMHO) is that it also kills any formatting you had in your endnotes - my code retains it.

As for Word's functionality, it already has built into it the ability to place footnotes at the bottom of each page, and endnotes at either the end of each Section (chapter), or at the end of the document. I have never before encountered a requirement for them to be moved to a separate document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 01-27-2012 at 07:03 PM.
Reply With Quote
  #11  
Old 01-28-2012, 09:39 AM
kenglade kenglade is offline Separating endnotes from text Mac OS X Separating endnotes from text Office for Mac 2011
Novice
Separating endnotes from text
 
Join Date: Dec 2011
Location: Rio Rancho, NM
Posts: 26
kenglade is on a distinguished road
Default

Macropod

I very much appreciate the time you're putting into this and I feel guilty about it. In any case, I've attached a sample, two as a matter of fact. sample.doc is the original. When I highlight the endnotes and run your macro I get the run time error but nothing is highlighted. sample_02 is the same material after running Stefan's macro on the highlighted material. Notice the "aXa"s in the copy. I can go through them, delete the "a" s on each side of the number, then superscript the number but that would take forever.

BTW, I'm running Word 2011 on an Intel Mac. To highlight the footnotes I use CMD-a rather than CTRL-a. Maybe the Mac thing is screwing it up.

Saludos,
Ken
Attached Files
File Type: doc sample.doc (30.5 KB, 10 views)
File Type: doc sample_02.doc (26.0 KB, 8 views)
Reply With Quote
  #12  
Old 01-28-2012, 12:21 PM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Moderator
 
Join Date: Aug 2011
Posts: 3,903
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

On a Windows system, running the macro with your example document certainly works as expected. That suggests the problem is MacWord-specific.
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional
Reply With Quote
  #13  
Old 01-28-2012, 03:07 PM
macropod's Avatar
macropod macropod is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Ken,

With the sample.doc you posted, does the Run-time error 4605 occur on that when you use the code I posted? If so, how much of the processing has been done at that stage (it might be easier to see if you uncomment the line 'Application.ScreenUpdating = False' before running the code)?

Both Doug's code (supplied by Stefan) and mine run to completion on a PC, so (assuming the answer to the first question above is yes) the errors seem to be either Mac-specific or specific to just your system. Maybe there's a fault with the Word installation on your system - that seems possible since neither the Find/Replace routine in Doug's code nor some aspect of my code work correctly. Be that as it may, you should be able to process the 'aXa' content left over from Doug's code with a wildcard Find/Replace (that's what the macro tries to do), where:
Find = a([0-9]{1,})a
Replace = \1
and the replacement font is set to superscript.

Finally, here's another two macros to try. The first is a modified version of Doug's code. It should retain both your endnote formatting and superscript the numbers. The second is a quite different macro I've written that will also preserve non-numeric endnote references (you previous reference to [i] suggested you were actually using roman numerals).
Code:
Sub ConvertEndNotes()
Application.ScreenUpdating = False
Dim aendnote As Endnote, Rng As Range
With ActiveDocument
  .Range.InsertAfter vbCr
  For Each aendnote In .Endnotes
    Set Rng = .Range.Characters.Last
    Rng.Style = "Endnote Text"
    With aendnote
      .Range.Copy
      Rng.InsertAfter vbCr & "[" & .Index & "] "
      Rng.Collapse wdCollapseEnd
      Rng.Paste
      .Reference.InsertBefore "[" & .Index & "]"
    End With
  Next aendnote
  For Each aendnote In .Endnotes
    aendnote.Reference.Delete
  Next aendnote
  With .Content.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "\[([0-9]{1,})\]"
    .Replacement.Style = "Endnote Reference"
    .Replacement.Text = "\1"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
End With
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
Code:
Sub UnLinkNotes()
Application.ScreenUpdating = False
Dim nRng As Range, eNote As Endnote, nRef As String
With ActiveDocument
  For Each eNote In .Endnotes
    With eNote
      With .Reference.Characters.First
        .Collapse wdCollapseStart
        .InsertCrossReference wdRefTypeEndnote, wdEndnoteNumberFormatted, eNote.Index
        nRef = .Characters.First.Fields(1).Result
        .Characters.First.Fields(1).Unlink
      End With
      .Range.Cut
    End With
    Set nRng = .Range
    With nRng
      .InsertAfter vbCr & nRef & " "
      With .Paragraphs.Last.Range
        .Style = "Endnote Text"
        .Words.First.Style = "Endnote Reference"
      End With
      .Collapse wdCollapseEnd
      .Paste
    End With
  Next
  For Each eNote In .Endnotes
    eNote.Delete
  Next
End With
Set nRng = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 01-29-2012, 07:46 AM
kenglade kenglade is offline Separating endnotes from text Mac OS X Separating endnotes from text Office for Mac 2011
Novice
Separating endnotes from text
 
Join Date: Dec 2011
Location: Rio Rancho, NM
Posts: 26
kenglade is on a distinguished road
Default

Curses. But thanks anyway. I have an old PC I never use anymore so once I get past this deadline I'll give it a try.

Saludos,
Ken
Reply With Quote
  #15  
Old 01-31-2012, 02:16 AM
macropod's Avatar
macropod macropod is offline Separating endnotes from text Windows 7 64bit Separating endnotes from text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Ken,

FWIW, does the following achieve what you're after?
Code:
Sub ExportEndNotes()
Application.ScreenUpdating = False
Dim Rng As Range, DocSrc As Document, DocTgt As Document, i As Long, StrRef As String
Set DocSrc = ActiveDocument
With DocSrc
  'Unlink endnote/footnote cross-references
  For i = .Fields.Count To 1 Step -1
    If .Fields(i).Type = wdFieldNoteRef Then .Fields(i).Unlink
  Next
 'Process all endnotes
  For i = 1 To .Endnotes.Count
    'First, process the endnote ref in the document body
    Set Rng = .Endnotes(i).Reference
    With Rng
      .Collapse wdCollapseStart
      'To get the actual reference text, we need to cross-reference it!
      .InsertCrossReference wdRefTypeEndnote, wdEndnoteNumberFormatted, i, False, False
      .End = .End + 1
      StrRef = .Text
      .Fields(1).Unlink
    End With
    'Second, process the endnote ref in the endnote
    Set Rng = .Endnotes(i).Range.Paragraphs.First.Range.Words.First
    With Rng
      If .Characters.Last Like "[ " & vbTab & "]" Then .End = .End - 1
      'Overwrite the existing endnote reference
      .Text = StrRef
    End With
  Next
  'Give Word a chance to do its housekeeping
  DoEvents
  'Create the output document
  Set DocTgt = Documents.Add
  'Replicate the endnotes in the body of the output document
  DocTgt.Range.FormattedText = .StoryRanges(wdEndnotesStory).FormattedText
  'Delete the endnotes from the source document
  For i = .Endnotes.Count To 1 Step -1
    .Endnotes(i).Delete
  Next
End With
Set Rng = Nothing: Set DocTgt = Nothing: Set DocSrc = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing footnotes to endnotes Sarah Word 3 04-27-2017 08:55 PM
Separating endnotes from text Copying endnotes kenglade Word 4 12-03-2011 01:26 PM
Index entries in endnotes perhj Word 0 06-19-2011 09:28 AM
Separating endnotes from text how do I change fonts for endnotes of word 2007? Brent Word 5 02-01-2011 03:15 PM
Separating accounts aka252 Outlook 0 02-23-2006 07:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:50 PM.


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