Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-28-2023, 07:01 AM
abdo abdo is offline Manual Footnotes to Automatic Footnotes Windows 10 Manual Footnotes to Automatic Footnotes Office 2021
Novice
Manual Footnotes to Automatic Footnotes
 
Join Date: May 2022
Posts: 5
abdo is on a distinguished road
Default

While searching, I did try this code here:
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
I changed numbers in the Word document from Arabic to English, also changed
Code:
"\[([0-9]{1,})\]"
To

Code:
"\(([0-9]{1,})\)"
And deleted the first ".Font.Superscript = True", But when I run the code, always get (Type mismatch Error 13).
Reply With Quote
 

Tags
footnote style



Similar Threads
Thread Thread Starter Forum Replies Last Post
Manual Footnotes to Automatic Footnotes Convert static superscript footnotes to dynamic footnotes glmcmillan Word VBA 1 09-05-2022 06:53 AM
Request for a macro to move footnotes (not formatted as footnotes) from end of page to end of doc Pluckedchicken Word VBA 0 09-03-2020 05:21 AM
Manual Footnotes to Automatic Footnotes How to change superscript footnotes into genuine Word footnotes Knounte29 Word VBA 41 01-16-2020 04:48 PM
creating manuscript w/footnotes from separate documents containing chapters with footnotes-word 2010 Dottie Publisher 0 02-19-2017 03:18 PM
Convert manual cross references in footnotes to other footnotes to automatic cross references ghumdinger Word VBA 7 11-20-2014 11:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:15 AM.


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