View Single Post
 
Old 08-12-2025, 04:47 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

RobiNew


You would have gotten a compact expert answer from any one of the contributors here had you posted your entire code snippet from the start.

I would suggest you change your use of font.superscript to the style method as Paul suggested. Also, with the code you have now, you could create a colossal mess if you need to edit the document to create additional footnotes or the code is inadvertently run again on the document.




Code:
Option Explicit
Sub AddSufficToFootnoteRef()
Dim ftNote As Footnote
Dim supLetter As String
Dim bSkip As Boolean
  supLetter = "a"
  For Each ftNote In ActiveDocument.Footnotes
    bSkip = True
    With ftNote.Range
      If Not .Characters.First = supLetter Then
         bSkip = False
        .Characters.First.Previous = supLetter & " "
        .Characters.First.Style = wdStyleFootnoteReference
      End If
    End With
    If Not bSkip Then
      With ftNote.Reference
        .Characters.Last.InsertAfter supLetter
        .Characters.Last.Next.Style = wdStyleFootnoteReference
      End With
    End If
  Next
lbl_Exit:
  Exit Sub
End Sub

Sub InsertFootnote()
'Create a new suffixed footnote
Dim oFN As Footnote
Dim supLetter As String
  supLetter = "a"
  Application.Dialogs(wdDialogInsertFootnote).Execute
  Set oFN = Selection.Footnotes(1)
  With oFN.Range
    .Characters.First.Previous = supLetter & " "
    .Characters.First.Style = wdStyleFootnoteReference
  End With
  With oFN.Reference
    .Characters.Last.InsertAfter supLetter
    .Characters.Last.Next.Style = wdStyleFootnoteReference
  End With
  oFN.Range.Select
  Selection.Collapse wdCollapseEnd
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote