Footnote macro - brackets around not working properly
Hi everyone
Macro used to put brackets around footnotes in the body and the footnote.
But it only puts brackets around footnote in body of document now. It does not error.
Any ideas - thank you in advance.
Windows 10/Office 365 Business Standard
Sub BracketFootnoteNumbersandBody(control As IRibbonControl)
'You can run this macro multiple times if needed, for instance if you add more footnotes; it will just 'ignore all the numbers that have already been bracketed.
'If your document uses endnotes instead of footnotes, change the "wdFootnotesStory" to '"wdEndnotesStory".
'It isn't possible to make this format automatic, but you can install the following macro to
'insert brackets around any existing footnote numbers. I've assumed that you want the brackets around the numbers
'in the footnotes themselves, as well as in the references in the main text. If that's not what you want,
'remove all the code starting at the line containing "wdFootnotesStory" and
'ending with the "Set rg = 'Nothing" just before the "End Sub".
Dim rg As Range
Set rg = ActiveDocument.Range
With rg.Find
.Format = True
.Style = ActiveDocument.Styles(wdStyleFootnoteReference)
.Wrap = wdFindStop
While .Execute
If rg.Characters(1) <> "(" Then
rg.InsertBefore "("
rg.InsertAfter ")"
rg.Style = ActiveDocument.Styles(wdStyleFootnoteReference)
End If
rg.Collapse wdCollapseEnd
Wend
End With
Set rg = Nothing
Set rg = ActiveDocument.StoryRanges(wdFootnotesStory)
With rg.Find
.Format = True
.Style = ActiveDocument.Styles(wdStyleFootnoteReference)
.Wrap = wdFindStop
While .Execute
If rg.Characters(1) <> "(" Then
rg.InsertBefore "("
rg.InsertAfter ")"
rg.Style = ActiveDocument.Styles(wdStyleFootnoteReference)
End If
rg.Collapse wdCollapseEnd
Wend
End With
Set rg = Nothing
End Sub
Janine
|