Footnotes

T

Thomas B.

Hello everybody,
I was wondering if there is a way to automatically format
footnotes/endnotes in the following ways:

Text [reference number in square brackets]
and in the reference section
Reference number (no square brackets, normal font, 2 spaces between the
beginning of text)

and the opposite way.:

Text (reference number in superscript)
and in the reference section
[Reference number in brackets] Two spaces between the number and reference
text.


Working with Word 2000, XP, and 2003.

Any help will be greatly appreciated.
Thomas
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Thomas B. > écrivait :
In this message, < Thomas B. > wrote:

|| Hello everybody,
|| I was wondering if there is a way to automatically format
|| footnotes/endnotes in the following ways:
||
|| Text [reference number in square brackets]
|| and in the reference section
|| Reference number (no square brackets, normal font, 2 spaces between the
|| beginning of text)
||
|| and the opposite way.:
||
|| Text (reference number in superscript)
|| and in the reference section
|| [Reference number in brackets] Two spaces between the number and
reference
|| text.
||
||
|| Working with Word 2000, XP, and 2003.
||

With a macro you can easily automatically get one or the other (See below).
To have both choices, you would need and extra step that would ask what type
of format the user wants, or you would need toolbar buttons to call one or
the other format.
Let me know which way you want to go and I'll post the code.

In the meantime, look at this old macro of mine.
You need a macro called
InsertFootnote
so that you can intercept Word's Menu command.

You surely want to play with

.NumberingRule = wdRestartContinuous
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic

to adjust the footnote numbering scheme (numerals used, restart every page
or not...)
See the VBA help for all the constants that can be used.

'_______________________________________
Sub InsertFootnote()

Dim LocCursor As Range
Dim LocCursor1 As Range

Set LocCursor = Selection.Range


With ActiveDocument.Range(Start:=ActiveDocument.Content.Start, End:= _
ActiveDocument.Content.End)
With .FootnoteOptions
.Location = wdBottomOfPage
.NumberingRule = wdRestartContinuous
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic
End With
.Footnotes.Add Range:=Selection.Range, Reference:=""
End With

Selection.HomeKey wdLine
Selection.MoveRight wdSentence, 1, wdExtend
Selection.Font.Superscript = False
Selection.HomeKey wdLine
Selection.TypeText "["
Selection.MoveRight wdCharacter, 1
Selection.TypeText "]"
Selection.EndKey wdLine

LocCursor.InsertBefore "["
LocCursor.SetRange LocCursor.Start, LocCursor.End + 1
LocCursor.InsertAfter "]"
LocCursor.Font.Superscript = True
LocCursor.SetRange LocCursor.End, LocCursor.End

Set LocCursor1 = LocCursor.Duplicate
LocCursor1.SetRange LocCursor1.End, LocCursor1.End + 1

If Not LocCursor1 = " " Then
LocCursor.InsertAfter " "
LocCursor.Font.Superscript = False
End If

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
T

Thomas B.

Thanks a lot. Merci beucoup!
Thomas



Bonjour,

Dans son message, < Thomas B. > écrivait :
In this message, < Thomas B. > wrote:

|| Hello everybody,
|| I was wondering if there is a way to automatically format
|| footnotes/endnotes in the following ways:
||
|| Text [reference number in square brackets]
|| and in the reference section
|| Reference number (no square brackets, normal font, 2 spaces between the
|| beginning of text)
||
|| and the opposite way.:
||
|| Text (reference number in superscript)
|| and in the reference section
|| [Reference number in brackets] Two spaces between the number and
reference
|| text.
||
||
|| Working with Word 2000, XP, and 2003.
||

With a macro you can easily automatically get one or the other (See below).
To have both choices, you would need and extra step that would ask what type
of format the user wants, or you would need toolbar buttons to call one or
the other format.
Let me know which way you want to go and I'll post the code.

In the meantime, look at this old macro of mine.
You need a macro called
InsertFootnote
so that you can intercept Word's Menu command.

You surely want to play with

.NumberingRule = wdRestartContinuous
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic

to adjust the footnote numbering scheme (numerals used, restart every page
or not...)
See the VBA help for all the constants that can be used.

'_______________________________________
Sub InsertFootnote()

Dim LocCursor As Range
Dim LocCursor1 As Range

Set LocCursor = Selection.Range


With ActiveDocument.Range(Start:=ActiveDocument.Content.Start, End:= _
ActiveDocument.Content.End)
With .FootnoteOptions
.Location = wdBottomOfPage
.NumberingRule = wdRestartContinuous
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic
End With
.Footnotes.Add Range:=Selection.Range, Reference:=""
End With

Selection.HomeKey wdLine
Selection.MoveRight wdSentence, 1, wdExtend
Selection.Font.Superscript = False
Selection.HomeKey wdLine
Selection.TypeText "["
Selection.MoveRight wdCharacter, 1
Selection.TypeText "]"
Selection.EndKey wdLine

LocCursor.InsertBefore "["
LocCursor.SetRange LocCursor.Start, LocCursor.End + 1
LocCursor.InsertAfter "]"
LocCursor.Font.Superscript = True
LocCursor.SetRange LocCursor.End, LocCursor.End

Set LocCursor1 = LocCursor.Duplicate
LocCursor1.SetRange LocCursor1.End, LocCursor1.End + 1

If Not LocCursor1 = " " Then
LocCursor.InsertAfter " "
LocCursor.Font.Superscript = False
End If

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top