Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 08-12-2025, 01:46 AM
vivka vivka is offline Insert a letter 'a' after the reference number in the footnote area Windows 7 64bit Insert a letter 'a' after the reference number in the footnote area Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi, RobiNew! I'm sorry Greg's answer hurt your feelings. I've reread his post and may conclude that he didn't mean anything to insult you. It's the disadvantage of written texts: they can be read with the intonation different from the author's. However it's only my opinion. We are all here to help each other according to our knowledge and experience. Let me offer one more solution to your request as I understand it. The code is a modification of yours as you asked. It inserts a superscripted 'a' before the space that precedes ftNote, i.e. after the ftNote number. If this is not what you want, please, specify the task in more details.


Code:
 With ftNote.Range
       .Characters.First.Previous = supLetter & Chr(32)
       .Characters.First.Font.Superscript = True
 End with
Reply With Quote
  #17  
Old 08-12-2025, 02:24 AM
RobiNew RobiNew is offline Insert a letter 'a' after the reference number in the footnote area Windows 11 Insert a letter 'a' after the reference number in the footnote area Office 2016
Competent Performer
Insert a letter 'a' after the reference number in the footnote area
 
Join Date: Sep 2023
Posts: 208
RobiNew is on a distinguished road
Default

Thanks a lot, Vivka! As I said some time ago, you are always the best. With your code my macro works perfectly. All the best from RobiNew
Reply With Quote
  #18  
Old 08-12-2025, 02:30 AM
RobiNew RobiNew is offline Insert a letter 'a' after the reference number in the footnote area Windows 11 Insert a letter 'a' after the reference number in the footnote area Office 2016
Competent Performer
Insert a letter 'a' after the reference number in the footnote area
 
Join Date: Sep 2023
Posts: 208
RobiNew is on a distinguished road
Default

Hi macropod! I didn't do anything stupid on activating your macro. The only stupid thing I did was to think that an expert could easily modify my bit of code. But perhaps the idea was not so stupid after all, because Vivka has now done what I expected from an expert. Here below is my simple macro with Vivka's modifications. It works perfectly in both areas. All the best!


Sub AddSuperscriptLetterToFootnotes()
Dim ftNote As Footnote
Dim supLetter As String
Dim i As Integer

supLetter = "a"
'Loop through all footnotes
For i = 1 To ActiveDocument.Footnotes.Count
Set ftNote = ActiveDocument.Footnotes(i)

'Main Document Reference
With ftNote.Reference
.InsertAfter supLetter
.Characters(.Characters.Count).Font.Superscript = True
End With

'Footnote Text Area
With ftNote.Range
.Characters.First.Previous = supLetter & Chr(32)
.Characters.First.Font.Superscript = True
End With
Next i
MsgBox "Superscript letters added to footnote references.", vbInformation
Reply With Quote
  #19  
Old 08-12-2025, 02:46 AM
vivka vivka is offline Insert a letter 'a' after the reference number in the footnote area Windows 7 64bit Insert a letter 'a' after the reference number in the footnote area Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Great! We did it at last! Actually, the task was quite simple. Obviously, it was the desire to help with the whole macro, not part of it that caused misunderstanding. All is good that ends good! RobiNew, thank you for your kind words, but I know my level, it's much-much lower than that of gurus' on this forum. Hope to hear from you soon!
PS.
This part of Greg 's code will also do the job:
Code:
With ftNote
     .Range.Characters.First.Previous.Delete     
     .Range = supLetter & " " & .Range     
     .Range.Characters.First.Font.Superscript = True 
End With
Reply With Quote
  #20  
Old 08-12-2025, 04:47 AM
gmaxey gmaxey is offline Insert a letter 'a' after the reference number in the footnote area Windows 10 Insert a letter 'a' after the reference number in the footnote area 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
  #21  
Old 08-12-2025, 05:10 AM
macropod's Avatar
macropod macropod is offline Insert a letter 'a' after the reference number in the footnote area Windows 10 Insert a letter 'a' after the reference number in the footnote area Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,465
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 RobiNew View Post
Hi macropod! I didn't do anything stupid on activating your macro. The only stupid thing I did was to think that an expert could easily modify my bit of code.
Keep that attitude up and you'll very quickly find your account here terminated.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter rekent Word VBA 2 01-14-2025 01:45 PM
Using text frames in the Footnote area RRB Word 9 12-07-2023 02:30 AM
Insert a letter 'a' after the reference number in the footnote area Macro to change font size of Footnote Reference in Footnote Text TheBigBoss Word VBA 5 06-10-2022 06:14 AM
Insert a letter 'a' after the reference number in the footnote area Removing line break and indentation between footnote number and footnote text in Word jaanross Word 5 02-06-2020 12:04 AM
Insert a letter 'a' after the reference number in the footnote area Adding footnote number as part of footnote text NoCalScribe Word VBA 3 07-15-2019 07:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:25 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