Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2017, 10:18 AM
Knounte29 Knounte29 is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 64bit
Novice
How to change superscript footnotes into genuine Word footnotes
 
Join Date: Feb 2017
Posts: 6
Knounte29 is on a distinguished road
Default How to change superscript footnotes into genuine Word footnotes

I converted a book from PDF to DOC using Abode Acrobat. The DOC is attached.



I would like to know how to change the superscript footnotes into genuine Word footnotes.

The attachment is just the first page of the book. The book is quite long. I hope there is a blanket fix or a fix that involves a few clicks for each footnote.

Thank you.
Attached Files
File Type: doc Book.doc (25.5 KB, 49 views)
Reply With Quote
  #2  
Old 02-11-2017, 10:20 PM
macropod's Avatar
macropod macropod is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

When documents with footnotes are converted to Word from other programs, the footnotes may come across as plain text, with the footnote links simply showing as superscripted numbers or numbers enclosed in brackets. The following macro processes such footnotes in a selected range, turning them into 'proper' Word footnotes, retaining their formatting (eg bold/italic/underline).

The macro assumes:
• The selected range contains the footnotes to be converted, with the first footnote number being, at most, enclosed in square brackets, thus [#], followed by a space. Comments in the code indicate where to make changes to suit other scenarios. If the footnotes are scattered throughout the document, rather than at the end, for example, the code will process the selected footnote text on each page
• you’ll be using the 'Footnote Text' style footnotes. If not, you can simply change it in the line:
.Style = "Footnote Text"
• each footnote consists of a single paragraph. If you have any multi-paragraph footnotes, you can get around that issue by changing their internal paragraph markers to line feeds (i.e. Shift-Enter) before running the macro.

The macro shows its progress on the status bar.

Code:
Sub ReLinkFootNotes()
Dim i As Long, j As Long, k As Long, l As Long, FtRng As Range
Application.ScreenUpdating = False
With ActiveDocument
  Set FtRng = Selection.Range
  With FtRng
    .Style = "Footnote Text"
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
    ' Change '[' and ']' on the next line to whatever is appropriate if the selected
    ' footnotes' numbers are enclosed in characters other than square brackets
    ' (e.g. .Text = "([0-9]{1,})" if there are no brackets)
      .Text = "\[([0-9]{1,})\]"
      .Replacement.Text = "\1"
      .Forward = True
      .Wrap = wdFindStop
      .Format = True
    ' Delete the next line if the footnote references are not superscripted.
      .Font.Superscript = True
      .MatchCase = False
      .MatchWholeWord = False
      .MatchAllWordForms = False
      .MatchSoundsLike = False
      .MatchWildcards = True
      .Execute Replace:=wdReplaceAll
    End With
    k = .Paragraphs(1).Range.Words(1) - 1
    j = k
    l = ActiveDocument.Footnotes.Count - k
    For i = 1 To .Paragraphs.Count
      If .Paragraphs(i).Range.Words(1) = j + 1 Then
        j = j + 1
      End If
    Next i
  End With
  For i = k + 1 To j
    StatusBar = "Finding Footnote Location: " & i + l
    With .Content.Find
      ' Change '"[" & i & "]"' string on the next line to whatever is appropriate
      ' if the in-line references are not enclosed in square brackets
      .Text = "[" & i & "]"
      ' Delete/comment out the next line if not applicable
      .Font.Superscript = True
      .MatchWholeWord = True
      .MatchWildcards = False
      .Execute
      If .Found = True Then
        .Parent.Select
        With Selection
          .Delete
          .Footnotes.Add Range:=Selection.Range, Text:=""
        End With
      End If
    End With
  Next i
  With FtRng
    For i = k + 1 To j
      StatusBar = "Transferring Footnote: " & i + l
      With .Paragraphs(1).Range
        .Cut
        With ActiveDocument.Footnotes(i + l).Range
          .Paste
          .Words(1).Delete
          .Characters.Last.Delete
        End With
      End With
    Next i
  On Error Resume Next
  End With
  Set FtRng = Nothing
End With
Application.ScreenUpdating = True
End Sub
How the code works:
• Take the selected footnote paragraphs, strip off any enclosing characters from the numbers.
• Apply the footnote style to the selected footnote paragraphs
• Count the number of bookmarked paragraphs with sequential numbers, starting at the first paragraph’s footnote number.
• Find the corresponding footnote numbers in the document
• Turn the matched numbers into empty footnotes
• Cut & Paste the footnote paragraphs into the empty footnotes
• Delete the first word (footnote number) and last character (duplicate para mark) from each footnote.

For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-14-2017, 12:04 PM
Knounte29 Knounte29 is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 64bit
Novice
How to change superscript footnotes into genuine Word footnotes
 
Join Date: Feb 2017
Posts: 6
Knounte29 is on a distinguished road
Default

Thank you, but when I run the macro it says Run-time error '13': Type mismatch

I then clicked "debug" and it highlighted the following line in yellow: k = .Paragraphs(1).Range.Words(1) - 1
Reply With Quote
  #4  
Old 02-14-2017, 02:00 PM
macropod's Avatar
macropod macropod is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Did you select the 'footnotes' you want to process? Note the specification in my previous post:
Quote:
• The selected range contains the footnotes to be converted
The code works fine for me with your attachment when that is done.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-15-2017, 12:55 PM
Knounte29 Knounte29 is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 64bit
Novice
How to change superscript footnotes into genuine Word footnotes
 
Join Date: Feb 2017
Posts: 6
Knounte29 is on a distinguished road
Default

Unfortunately, it doesn't work for me. Here are the steps I took:

Opened Microsoft Word 2010
Clicked Macros
In the Macro name field I typed Macro2017
Clicked Create
Copied and pasted the code from this forum into the window
Exited out
Highlighted all four notes at the bottom of Book.doc using shift key
Clicked Macros
Clicked Run for Macro2017

Message pops up saying Run-time error '5941': The requested member of the collection does not exist.
Reply With Quote
  #6  
Old 02-15-2017, 03:14 PM
macropod's Avatar
macropod macropod is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by Knounte29 View Post
Unfortunately, it doesn't work for me. Here are the steps I took:

Opened Microsoft Word 2010
Clicked Macros
In the Macro name field I typed Macro2017
Clicked Create
Copied and pasted the code from this forum into the window.
That is not the process advised in the link I posted. The macro is already complete; your process embeds my macro inside another...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-16-2017, 07:36 PM
Knounte29 Knounte29 is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 64bit
Novice
How to change superscript footnotes into genuine Word footnotes
 
Join Date: Feb 2017
Posts: 6
Knounte29 is on a distinguished road
Default

I have tried many approaches and cannot get it to work. In my most recent attempt, footnote #1 disappears when I run the macro.

Do you have MS Word 2010? If so, could you maybe type the exact steps you took? I'm sorry but I need it really simple. For example, "1. Click Macros, 2. Click Create, etc"

Also, can you attach Book.doc to your next post so I can see what the corrected file looks like?

Thank you!
Reply With Quote
  #8  
Old 02-16-2017, 09:39 PM
macropod's Avatar
macropod macropod is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

The real issue, IMHO, is whether you followed the PC macro installation & usage instructions in the link I gave you.

Document with macro & processed document attached.

As per the notes in the macro code, all you (still) need to do is change:
.Text = "\[([0-9]{1,})\]"
to:
.Text = "([0-9]{1,})"
Attached Files
File Type: doc Book.doc (43.0 KB, 48 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 02-17-2017, 12:01 PM
Knounte29 Knounte29 is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 64bit
Novice
How to change superscript footnotes into genuine Word footnotes
 
Join Date: Feb 2017
Posts: 6
Knounte29 is on a distinguished road
Default

Clearly it does work. That is amazing.

I will set aside some time and try to follow the "PC macro installation & usage instructions" very carefully.
Reply With Quote
  #10  
Old 02-23-2017, 01:38 PM
Knounte29 Knounte29 is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 64bit
Novice
How to change superscript footnotes into genuine Word footnotes
 
Join Date: Feb 2017
Posts: 6
Knounte29 is on a distinguished road
Default

Well, I cannot get it to work. I spent hours trying different methods.

It is obvious I am doing something wrong.

When you say "select the footnotes you want to process," do you mean highlight them using the shift key? Then click Run?
Reply With Quote
  #11  
Old 02-24-2017, 08:03 PM
macropod's Avatar
macropod macropod is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by Knounte29 View Post
When you say "select the footnotes you want to process," do you mean highlight them using the shift key? Then click Run?
I mean that you select them - just like you'd select something you want to copy.
Quote:
Originally Posted by Knounte29 View Post
Well, I cannot get it to work. I spent hours trying different methods.

It is obvious I am doing something wrong.
Did you make the required changes to the code? I have mentioned the need for this repeatedly.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 07-12-2017, 06:41 AM
iwonder iwonder is offline How to change superscript footnotes into genuine Word footnotes Windows 10 How to change superscript footnotes into genuine Word footnotes Office 2013
Novice
 
Join Date: Jun 2017
Location: France
Posts: 10
iwonder is on a distinguished road
Default

Hello

Was it supposed to work if footnotes are dispersed/disseminated in the document ?

I mean when each footnote is located at the bottom of the page where it's called from - because that's what I often (always) notice when I convert PDF documents to Word documents, and that's what I was expecting to find in this post.

Here, the code doesn't work when 'footnotes' paragraphs are selected with the Ctrl key (even in the Knounte29 sample text: only the last selected 'footnote' paragraph is correctly changed to genuine footnote).

If a coder could fix this, I would be very grateful.

Bernard

Sorry, but should I create a new thread for this ?
Reply With Quote
  #13  
Old 07-12-2017, 05:07 PM
macropod's Avatar
macropod macropod is offline How to change superscript footnotes into genuine Word footnotes Windows 7 64bit How to change superscript footnotes into genuine Word footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Did you compare the attachments in posts #1 & #8? You'll see from them that, if the instructions in post #2 are followed exactly, the process works as described.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 07-12-2017, 06:16 PM
iwonder iwonder is offline How to change superscript footnotes into genuine Word footnotes Windows 10 How to change superscript footnotes into genuine Word footnotes Office 2013
Novice
 
Join Date: Jun 2017
Location: France
Posts: 10
iwonder is on a distinguished road
Default

Paul, thanks for replying

I did follow your explainations, but in the test file sent by Knoute29, footnotes are gathered together, and yes, it works fine if selected in a row (altogether).

But when notes are disseminated (scattered?) in the text (as they are in my converted files), i have to select them with the Ctrl key, and in that case, i found that it doesn't work
Am I right ?

Quote:
Originally Posted by macropod View Post
Did you compare the attachments in posts #1 & #8? You'll see from them that, if the instructions in post #2 are followed exactly, the process works as described.
Reply With Quote
  #15  
Old 07-12-2017, 06:32 PM
iwonder iwonder is offline How to change superscript footnotes into genuine Word footnotes Windows 10 How to change superscript footnotes into genuine Word footnotes Office 2013
Novice
 
Join Date: Jun 2017
Location: France
Posts: 10
iwonder is on a distinguished road
Default

Below are the code and sample text used :
Did I made a mistake ?

Code:
Sub ReLinkFootNotes()
    Dim i As Integer, j As Integer, k As Integer, l As Integer, FtRng As Range
    Application.ScreenUpdating = False
    With ActiveDocument
        Set FtRng = Selection.Range
        With FtRng
            .Style = "Note de bas de page"
            With .Find
                .ClearFormatting
                .Replacement.ClearFormatting
                 ' Change '[' and ']' on the next line to whatever is appropriate if the selected
                 ' footnotes' numbers are enclosed in characters other than square brackets
                .Text = "([0-9]{1;})"
                .Replacement.Text = "\1"
                .Forward = True
                .Wrap = wdFindStop
                .Format = False
                .MatchCase = False
                .MatchWholeWord = False
                .MatchAllWordForms = False
                .MatchSoundsLike = False
                .MatchWildcards = True
                .Execute Replace:=wdReplaceAll
            End With
            k = .Paragraphs(1).Range.Words(1) - 1
            j = k
            l = ActiveDocument.Footnotes.Count - k
            For i = 1 To .Paragraphs.Count
                If .Paragraphs(i).Range.Words(1) = j + 1 Then
                    j = j + 1
                End If
            Next i
        End With
        For i = k + 1 To j
            StatusBar = "Finding Footnote Location: " & i + l
            With .Content.Find
                 ' Change '"[" & i & "]"' string on the next line to whatever is appropriate
                 ' if the in-line references are not enclosed in square brackets
                .Text = i
                 ' Delete/comment out the next line if not applicable
                .Font.Superscript = True
                .MatchWholeWord = True
                .MatchWildcards = False
                .Execute
                If .Found = True Then
                    .Parent.Select
                    With Selection
                        .Delete
                        .Footnotes.Add Range:=Selection.Range, Text:=""
                    End With
                End If
            End With
        Next i
        With FtRng
            For i = k + 1 To j
                StatusBar = "Transferring Footnote: " & i + l
                With .Paragraphs(1).Range
                    .Cut
                    With ActiveDocument.Footnotes(i + l).Range
                        .Paste
                        .Words(1).Delete
                        .Characters.Last.Delete
                    End With
                End With
            Next i
            On Error Resume Next
        End With
        Set FtRng = Nothing
    End With
    Application.ScreenUpdating = True
End Sub
Attached Files
File Type: doc testfile.doc (66.5 KB, 16 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change superscript footnotes into genuine Word footnotes Word footnotes and track changes problem Carnegie Word 14 03-13-2017 01:31 AM
Convert manual cross references in footnotes to other footnotes to automatic cross references ghumdinger Word VBA 7 11-20-2014 11:47 PM
How to change superscript footnotes into genuine Word footnotes word 2007 - footnotes and text box glggluig Word 1 08-10-2014 04:09 AM
How to change superscript footnotes into genuine Word footnotes Corrupted footnotes in Word mythander889 Word 12 09-11-2012 03:58 PM
How to change superscript footnotes into genuine Word footnotes Can Word automatically update footnotes? gib65 Word 2 08-15-2011 01:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:07 AM.


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