Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-09-2025, 06:37 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 Insert a letter 'a' after the reference number in the footnote area

I want to insert a letter 'a' after the reference number in the footnote area, a number that is always followed by a space. I use the code here below, but the result I get is not |1a| but |1 a|.
Can someone help? Thanks!

With ftNote.Range


.InsertBefore supLetter 'i.e. the letter a
.Characters(1).Font.Superscript = True
End With
Reply With Quote
  #2  
Old 08-09-2025, 07:07 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


Your code doesn't do anything. Inserting the "a" after the reference number as you request is at best a mirage. It will not affect the numbering of the footnote in the document body.


In any case:

Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim ftNote As Footnote
Dim supLetter As String
  supLetter = "a"
  Set ftNote = ActiveDocument.Footnotes(1)
  With ftNote
    .Range.Characters.First.Previous.Delete
    .Range = supLetter & " " & .Range
    .Range.Characters.First.Font.Superscript = True
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 08-09-2025, 07:44 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

Thank you, gmaxey! But my code works, no mirage. The only trouble is that it inserts the 'a' after instead of before the space: |1 a| instead of |1a |. The numbering of the footnotes in the document body has been dealt with before with adequate code.
I cannot adopt your code, because it deletes the reference number. My code doesn't, neither in the main document nor in the footnote area.
Reply With Quote
  #4  
Old 08-09-2025, 08:28 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,


We will have to agree to disagree. The code you posted doesn't work to do anything.


Start with a document with 1 footnote.


Code:
Sub ScratchMacro()
  'Here is your code.  If you try to run it, you will see it does nothing but error
  With ftNote.Range
    .InsertBefore supLetter 'i.e. the letter a
    .Characters(1).Font.Superscript = True
  End With
lbl_Exit:
  Exit Sub
End Sub
Sub ScratchMacro2()
'Here is your code modified with variables declared and defined.
'No erorrs and doing what you decribed.
Dim ftNote As Footnote
Dim supLetter As String
  Set ftNote = ActiveDocument.Footnotes(1)
  supLetter = "a"
  With ftNote.Range
    .InsertBefore supLetter 'i.e. the letter a
    .Characters(1).Font.Superscript = True
  End With
  'As you see, this does nothing to the actual reference in the document body.
lbl_Exit:
  Exit Sub
End Sub
Sub ScratchMacro3()
'A basic Word Macro coded by Gregory K. Maxey
'This is my code. It gives the illusion that the reference number has been changed from 1 to 1a, but
'has no affect on the actual reference number in the document body.
Dim ftNote As Footnote
Dim supLetter As String
  supLetter = "a"
  Set ftNote = ActiveDocument.Footnotes(1)
  With ftNote
    .Range.Characters.First.Previous.Delete
    .Range = supLetter & " " & .Range
    .Range.Characters.First.Font.Superscript = True
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #5  
Old 08-11-2025, 12:04 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

Thank you, gmaxey! As I wrote before my code works all right in the context of a macro. I have no problems with the reference numbers in the main document. All I need is a code that will ADD the letter 'a' after the reference number in the footnote area.
Perhaps someone will modify my code so as to obtain '1a ' instead of the wrong '1 a'. Here is again my wrong code:
With ftNote.Range
.InsertBefore supLetter 'i.e. the letter a
.Characters(1).Font.Superscript = True
End With
Reply With Quote
  #6  
Old 08-11-2025, 01:27 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! If I understand your request correctly, try the following:
Code:
With ftNote.range
    ActiveDocument.range(.start - 1, .End).InsertBefore supLetter
End With

Last edited by vivka; 08-11-2025 at 02:43 PM.
Reply With Quote
  #7  
Old 08-11-2025, 04:30 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

I have already provided you the answer twice. If you can't post functional code, why should anyone else. The code I have given you acted on footnote 1. If you want an "a" after all footnotes you can use:

Code:
Sub ScratchMacro3()
'A basic Word Macro coded by Gregory K. Maxey
Dim ftNote As Footnote
Dim supLetter As String
  supLetter = "a"
  For Each ftNote In ActiveDocument.Footnotes
    With ftNote
      .Range.Characters.First.Previous.Delete
      .Range = supLetter & " " & .Range
      .Range.Characters.First.Font.Superscript = True
    End With
  Next
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #8  
Old 08-11-2025, 07:34 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

Thank you Vivka! Unfortunately your code doesn't work in my macro. Please note that I need an "a" after all footnote numbers in the footnote area. I need a modification of my line '.Characters(1).Font.Superscript = True' to obtain '1a ' instead of '1 a'. All the best!

Thank you gmaxey! As you certainly know by now I'm not an expert. If you prefer not to modify my code (which works all right for '1 a', but not for '1a '), then please suggest a macro that does the job in both the main document and the footnote area, because that is what my macro does (correctly in the main document: '1a'). All the best!
Reply With Quote
  #9  
Old 08-11-2025, 08:14 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

As I have told you twice before, your macro does nothing!! If you want to send the code that does do something then perhaps I could assist you further. However, if you want to continue insisting that your non-functional code works then I will bow out.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #10  
Old 08-11-2025, 02:39 PM
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 again, RobiNew! Greg's code works without a hitch (at least for me). The code inserts a superscripted 'a' after each footnote number, just as you requested. Or may be I don't quite understand your point.
Reply With Quote
  #11  
Old 08-11-2025, 03:46 PM
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

Ho hum:
Code:
Sub InsertFootnote()
Dim Rng As Range: Set Rng = Selection.Range
Application.Dialogs(wdDialogInsertFootnote).Execute
Rng.End = Rng.End + 1: Rng.InsertAfter "a": Rng.Style = wdStyleFootnoteReference
Selection.Start = Selection.Start - 1
Set Rng = Selection.Range: Rng.Collapse wdCollapseStart
Rng.Start = Rng.Start - 1: Rng.InsertAfter "a": Rng.Style = wdStyleFootnoteReference
Selection.Collapse wdCollapseEnd
If ActiveWindow.ActivePane.View.Type = wdPrintView Or ActiveWindow. _
  ActivePane.View.Type = wdWebView Or ActiveWindow.ActivePane.View.Type = wdPrintPreview Then
  ActiveWindow.View.SeekView = wdSeekFootnotes
Else
  ActiveWindow.View.SplitSpecial = wdPaneFootnotes
End If
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 08-12-2025, 12:43 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 Vivka! Yes, Greg's code works without a hitch, but only in the footnotes. Besides, he insists on my being a liar, because I say that my code works, though not exactly as I want.
Reply With Quote
  #13  
Old 08-12-2025, 01:05 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! Thank you for your 'ho hum' and for the code. This is what it does:
- in the main document it completely deletes the first footnote and leaves the others unchanged;
- in the footnote area it creates '1a' without the footnote content and leaves all the other reference numbers unchanged.
Wouldn't it be easier for you experts to modify my code so as to obtain '1a ' instead of '1 a'? Cheers, RobiNew
Reply With Quote
  #14  
Old 08-12-2025, 01:06 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 Vivka! Yes, Greg's code works without a hitch, but only in the footnotes. Besides, he insists on my being a liar, because I say that my code works, though not exactly as I want.
I suggest you watch your language. I don't see Greg accusing you of being a liar. He simply disagrees with you, which is understandable as you've failed to provide sufficient code to make what you posted work. For starters, there is no sure way to tell what your 'ftNote' variable refers to.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 08-12-2025, 01: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! Thank you for your 'ho hum' and for the code. This is what it does:
- in the main document it completely deletes the first footnote and leaves the others unchanged;
- in the footnote area it creates '1a' without the footnote content and leaves all the other reference numbers unchanged.
The code I posted inserts a single footnote. Even the sub's name makes that clear enough. It does not delete an existing footnote unless you've stupidly selected an existing one before running it.

Your problems in this thread are entirely of your own making, for the simple reason that all you've deigned to provide is a code snippet with no context.
__________________
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