PDA

View Full Version : Code for footnotes?



thefrasers
09-08-2014, 03:48 AM
I use footnotes in MS Word 2010 a lot. I keep getting frustrated by the fact that the default behavior is continuous numbering, whereas I want to change it to restart each page. While I can do this for each document on an ad hoc basis, it would be nice if I could reset default behavior. I can't find a simple way of doing it so I guess that I should plonk some code into the particular template that I'm using (I assume that changing Normal wouldn't make a difference?). I can't find the code using my usual platter of Google searches and delving into forums. I may just have missed it, but is it even possible to do this?

gmayor
09-08-2014, 04:08 AM
It is certainly possible, and relatively simple to do, by intercepting the insert footnote command - and you can do it for all documents by adding the macro to the normal template. The macro you want is


Sub InsertFootnoteNow()
With Selection
With .FootnoteOptions
.Location = wdBottomOfPage
.NumberingRule = wdRestartPage
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic
End With
.Footnotes.Add Range:=Selection.Range, Reference:=""
End With
End Sub

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

thefrasers
09-08-2014, 04:38 AM
Thanks for the prompt reply. As I tried to include it I discovered that it is so long since I used VBA in Word that I have forgotten how to do many things. A quick look at the existing VBA in my normal template uncovered a whole bunch of macros that I wrote years ago but have only a limited idea as to the functionality. The code below will adjust my insert footnote behaviour if I run the macro at some stage during writing the document, but I can adjust almost as quickly by simply changing the options on the insert footnote bar. What I want to do is have the macro run automatically whenever I open or create a new document. I presume I need to put some form of "Private sub" in the normal template. Can I gently ask for idiot-proof instructions?




It is certainly possible, and relatively simple to do, by intercepting the insert footnote command - and you can do it for all documents by adding the macro to the normal template. The macro you want is


Sub InsertFootnoteNow()
With Selection
With .FootnoteOptions
.Location = wdBottomOfPage
.NumberingRule = wdRestartPage
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic
End With
.Footnotes.Add Range:=Selection.Range, Reference:=""
End With
End Sub

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

gmayor
09-08-2014, 05:07 AM
The idiot's guide is the link below the code, however once installed, the macro will run every time you insert a footnote. The code intercepts the insert footnote command and sets the numbering rule to restart when the page changes. You don't have to physically run anything. It will do so automatically. By saving the code in the normal template, it will run for all documents, unless there is a macro with the same name in the document template - which seems unlikely.

thefrasers
09-09-2014, 02:32 AM
The idiot's guide is the link below the code, however once installed, the macro will run every time you insert a footnote. The code intercepts the insert footnote command and sets the numbering rule to restart when the page changes. You don't have to physically run anything. It will do so automatically. By saving the code in the normal template, it will run for all documents, unless there is a macro with the same name in the document template - which seems unlikely.