![]() |
|
#1
|
|||
|
|||
|
I found the code below on another post that formats footnotes with a tab. I seem to be having a couple of issues in that it removes the bold format from the Footnote Reference number and applies bold to the Footnote Text. How can I get the code to reverse this so the Footnote Reference is bold but the Footnote Text is not bold? I've checked the styles for both of these in the Styles Pane and they are set correctly eg Footnote Reference set as bold and Footnote Text set as not bold. I've also set the Footnote Text in the Styles Pane to be indented at 0.25" but could this be added to the code itself?
Footnote Image.JPG Code:
Sub InsertFootnote() ActiveDocument.Footnotes.Add Range:=Selection.Range With Selection .Paragraphs(1).Range.Font.Reset .Paragraphs(1).Range.Characters(2) = "" .InsertAfter vbTab .Font.Bold = True .Collapse wdCollapseEnd End With ActiveWindow.ScrollIntoView Selection.Range End Sub Sub InsertFootnoteNow() ActiveDocument.Footnotes.Add Range:=Selection.Range With Selection .Paragraphs(1).Range.Font.Reset .Paragraphs(1).Range.Characters(2) = "" .InsertAfter vbTab .Font.Bold = True .Collapse wdCollapseEnd End With ActiveWindow.ScrollIntoView Selection.Range End Sub |
|
#2
|
||||
|
||||
|
All you should need is:
Code:
Sub InsertFootnote()
With Selection
.Footnotes.Add Range:=.Range
With .Paragraphs(1).Range
.Characters(2) = vbTab
.Characters.Last.Select
End With
.Collapse
ActiveWindow.ScrollIntoView .Range
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Code:
Sub InsertFootnoteNow()
With Selection
.Footnotes.Add Range:=.Range
'To adjust the tab with, use these two lines
.Paragraphs(1).TabStops.ClearAll
.Paragraphs(1).TabStops(1).Position = 18 'change to suit
With .Paragraphs(1).Range
'If you only want the reference in the footnote modified use ...
.Characters(1).Font.Superscript = False
.Characters(1).Font.Bold = True
'... otherwise change the footnote reference style
.Characters(2) = vbTab
.Characters.Last.Select
End With
.Collapse
ActiveWindow.ScrollIntoView .Range
End With
lbl_Exit:
Exit Sub
End Sub
|
|
#4
|
|||
|
|||
|
Hi Macropod, thank you for the code, unfortunately, I couldn't get it to work using Ctrl Alt F.
Hi Greg, thank you for the code, I really appreciate it. I have added .Characters(1).Font.Size = 8 to bring the font size down from 10 to 8 and it seems to be working as I wanted it to without changing the actual style in the styles pane. Thank you so much. |
|
#5
|
||||
|
||||
|
Quote:
Whilst you might be happy with Greg's code, do be aware that it will lead to an unnecessary increase in file size compared to the once-off Style modifications. And, if you made those once-off Style modifications in Word's Normal Template, you'd likely never need to bother with them again. Plus, your documents will be less prone to corruption if you modify the Styles than if you use Greg's brute-force approach to modifying each footnote's formatting.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#6
|
|||
|
|||
|
Thank you Macropod for pointing out any issues that may arise with the other code, as it may become an issue on our larger 200 page documents with hundreds of footnotes within them.
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to remove extra space between footnote separator and 1st footnote. No para breaks present.
|
Swarup | Word | 2 | 07-09-2022 07:42 PM |
Macro to change font size of Footnote Reference in Footnote Text
|
TheBigBoss | Word VBA | 5 | 06-10-2022 06:14 AM |
Footnote references in the footnote section losing their style when cut+pasted from same doc
|
emblaw | Word | 4 | 12-08-2020 06:23 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 |