![]() |
|
#16
|
|||
|
|||
|
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
|
|
#17
|
|||
|
|||
|
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
|
|
#18
|
|||
|
|||
|
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 |
|
#19
|
|||
|
|||
|
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
|
|
#20
|
|||
|
|||
|
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
|
|
#21
|
||||
|
||||
|
Keep that attitude up and you'll very quickly find your account here terminated.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Thread Tools | |
| Display Modes | |
|
|
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 |
Macro to change font size of Footnote Reference in Footnote Text
|
TheBigBoss | Word VBA | 5 | 06-10-2022 06:14 AM |
Removing line break and indentation between footnote number and footnote text in Word
|
jaanross | Word | 5 | 02-06-2020 12:04 AM |
Adding footnote number as part of footnote text
|
NoCalScribe | Word VBA | 3 | 07-15-2019 07:20 PM |