Add tabulation to every footnote

M

menteith

Hi all,

I would like to every footnote in my Word document to start with
tabulation. The best idea is to probably write a macro which would chec
if a footnote starts with a tab and if it doesn't a tabulation should b
added to avoid adding more than one tab. Could you provide me with
such macro, please
 
S

Stefan Blom

If you mean that you want the first line to be indented, you could just add
a first line indent to the Footnote Text style.

On the other hand, if you are saying that you want a tab character *after*
the footnote number, then post back.
 
S

Stefan Blom

You can modify the Footnote Text style so that it includes a hanging indent
and then make use of macros to insert the notes. Use the following macro and
store it in the Normal template (for assistance, see
http://www.gmayor.com/installing_macro.htm):

Sub InsertFootnoteNow()
'Code by Dave Rado, modified by Stefan Blom
ActiveDocument.Footnotes.Add Range:=Selection.Range
With Selection
.Paragraphs(1).Range.Font.Reset
.Paragraphs(1).Range.Characters(2) = ""
.InsertAfter ". "
.Collapse wdCollapseEnd
End With
ActiveWindow.ScrollIntoView Selection.Range
End Sub

The macro intercepts the Insert Footnote command on the References tab; it
does not intercept the Footnote and Endnote dialog box.
 
P

Peter T. Daniels

Hi Stefan--

I don't understand macro texts; could you explain where this one is seeking
and/or inserting a tab character? In many situations that would be nicer
than the space or the nothing that normally appears after the footnote
reference.
 
S

Stefan Blom

Peter,

Thanks for your reply. You helped me notice a mistake. The line with
InsertAfter should include an instruction that adds a tab character:

Sub InsertFootnoteNow()
'Code by Dave Rado, modified by Stefan Blom
ActiveDocument.Footnotes.Add Range:=Selection.Range
With Selection
.Paragraphs(1).Range.Font.Reset
.Paragraphs(1).Range.Characters(2) = ""
.InsertAfter "." & vbTab
.Collapse wdCollapseEnd
End With
ActiveWindow.ScrollIntoView Selection.Range
End Sub
 
M

menteith

'Stefan Blom[_3_ said:
;494893']Peter,

Thanks for your reply. You helped me notice a mistake. The line with
InsertAfter should include an instruction that adds a tab character:

Sub InsertFootnoteNow()
'Code by Dave Rado, modified by Stefan Blom
ActiveDocument.Footnotes.Add Range:=Selection.Range
With Selection
.Paragraphs(1).Range.Font.Reset
.Paragraphs(1).Range.Characters(2) = ""
.InsertAfter "." & vbTab
.Collapse wdCollapseEnd
End With
ActiveWindow.ScrollIntoView Selection.Range
End Sub

--
Stefan Blom
Microsoft Word MVP




"Peter T. Daniels" (e-mail address removed) wrote in message
Hi Stefan--

I don't understand macro texts; could you explain where this one is
seeking
and/or inserting a tab character? In many situations that would b
nicer
than the space or the nothing that normally appears after the footnote
reference.

On Tuesday, November 5, 2013 2:55:26 PM UTC-5, Stefan Blom wrote:
-
You can modify the Footnote Text style so that it includes a hanging
indent
and then make use of macros to insert the notes. Use the followin
macro
and
store it in the Normal template (for assistance, see

http://www.gmayor.com/installing_macro.htm):

Sub InsertFootnoteNow()
'Code by Dave Rado, modified by Stefan Blom
ActiveDocument.Footnotes.Add Range:=Selection.Range
With Selection
.Paragraphs(1).Range.Font.Reset
.Paragraphs(1).Range.Characters(2) = ""
.InsertAfter ". "
.Collapse wdCollapseEnd
End With
ActiveWindow.ScrollIntoView Selection.Range
End Sub

The macro intercepts the Insert Footnote command on the References tab

it
does not intercept the Footnote and Endnote dialog box.-
-
"menteith" (e-mail address removed) wrote in message

Thanks for this. The macro add a dot to every footnote I create which i
not a thing I would like to have. Could you please rewrite this macro s
that is does not add tab on-the-fly but it adds it when I run thi
macro? So when the document is finished I could run the macro and i
would add a tab to every footnote which has not already started with
tab.
Thanks for your help
 
S

Stefan Blom

OK, you don't want the period to be added after the footnote number? And you
want a version that can be used on existing footnotes? Try the following:

Sub InsertFootnoteWithTabChar()
'Code by Stefan Blom, MVP
Dim f As Footnote
For Each f In ActiveDocument.Footnotes

With f.Range.Paragraphs(1).Range
.Characters(1).Font.Reset
.Characters(2).Text = vbTab
End With
Next f

End Sub

The macro replaces the second character in each footnote paragraph with a
tab (by default, Word adds a space).

To run the macro, attach it to a keyboard shortcut and/or a button on your
Quick Access Toolbar. See http://www.gmayor.com/installing_macro.htm.

--
Stefan Blom
Microsoft Word MVP




menteith said:
'Stefan Blom[_3_ said:
;494893']Peter,

Thanks for your reply. You helped me notice a mistake. The line with
InsertAfter should include an instruction that adds a tab character:

Sub InsertFootnoteNow()
'Code by Dave Rado, modified by Stefan Blom
ActiveDocument.Footnotes.Add Range:=Selection.Range
With Selection
.Paragraphs(1).Range.Font.Reset
.Paragraphs(1).Range.Characters(2) = ""
.InsertAfter "." & vbTab
.Collapse wdCollapseEnd
End With
ActiveWindow.ScrollIntoView Selection.Range
End Sub

--
Stefan Blom
Microsoft Word MVP




"Peter T. Daniels" (e-mail address removed) wrote in message
Hi Stefan--

I don't understand macro texts; could you explain where this one is
seeking
and/or inserting a tab character? In many situations that would be
nicer
than the space or the nothing that normally appears after the footnote
reference.

On Tuesday, November 5, 2013 2:55:26 PM UTC-5, Stefan Blom wrote:
-
You can modify the Footnote Text style so that it includes a hanging
indent
and then make use of macros to insert the notes. Use the following
macro
and
store it in the Normal template (for assistance, see

http://www.gmayor.com/installing_macro.htm):

Sub InsertFootnoteNow()
'Code by Dave Rado, modified by Stefan Blom
ActiveDocument.Footnotes.Add Range:=Selection.Range
With Selection
.Paragraphs(1).Range.Font.Reset
.Paragraphs(1).Range.Characters(2) = ""
.InsertAfter ". "
.Collapse wdCollapseEnd
End With
ActiveWindow.ScrollIntoView Selection.Range
End Sub

The macro intercepts the Insert Footnote command on the References tab;

it
does not intercept the Footnote and Endnote dialog box.-
-
"menteith" (e-mail address removed) wrote in message

Thanks for this. The macro add a dot to every footnote I create which is
not a thing I would like to have. Could you please rewrite this macro so
that is does not add tab on-the-fly but it adds it when I run this
macro? So when the document is finished I could run the macro and it
would add a tab to every footnote which has not already started with a
tab.
Thanks for your help!
 
M

menteith

Thanks, it works!

But there is a small problem: the macro (as the older version you hav
made) makes a footnote number bigger, that is, 1, 2 and so on get bigge
when you run the macro. I do not know why is that.

Could you check it?

And would it be a problem if you could make this macro in two versions
one that adds a tab on-the-fly, and the other one the way it works now
that is, adds a tab to already written footnotes
 
S

Stefan Blom

The macro clears the superscript formatting on the footnote number. If you
are saying that you don't want that, use the following instead:

Sub InsertFootnoteWithTabChar()
'Code by Stefan Blom, MVP
Dim f As Footnote
For Each f In ActiveDocument.Footnotes

With f.Range.Paragraphs(1).Range
.Characters(2).Text = vbTab
End With
Next f

End Sub
 
M

menteith

Dear Stefan

It works flawlessly now but it always adds a tab even if it has alread
been added. Is there a way to avoid it, that is, to add a tab only whe
footnote has not already started with a tab? Thank you for your time an
effort

Could you also rewrite the script to add a tab on-the-fly as a footnot
is added (as in your first version)
 
S

Stefan Blom

It is a rather basic macro; it replaces the second character (that is, the
one following the footnote number) with a tab character. It isn't checking
for an already existing tab.

Are you saying that most footnotes already have a tab character? In that
case, modifying the Footnote Text style to include a hanging indent would
suffice.
 

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