Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding a tab and an indent after a footnote

    Hi there, I am trying to create a button to update the footnote style. I have created the button and changed the font and paragraph spacing and managed to add a tab stop, but ideally I would just like it to automatically tab from the footnote number at tabstop 1.2 and for the second line to also be a hanging indent to 1.2.

    The code I currently have is:

    'changes the footnote style
    With ActiveDocument.Styles("Footnote Text")
    .ParagraphFormat.SpaceBefore = 6
    .Font.Size = 8
    .ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(1.2)
    End With

    How would I get it to actually put the tab in and add a hanging indent to 1.2.

    Any help would be much appreciated.

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    You don't necessarily need a macro to change the formatting of the Footnote Text style - you could just modify that style interactively in the document and/or template.

    Either way, to put in the tab, it has to be done in conjunction with the action of adding a footnote - you could try something like this:
    Code:
    Public Sub SpecialInsertFootnote()
       With Selection
          With .FootnoteOptions
             .Location = wdBottomOfPage
             .NumberingRule = wdRestartContinuous
             .StartingNumber = 1
             .NumberStyle = wdNoteNumberStyleArabic
          End With
          .Footnotes.Add Range:=Selection.Range, Reference:=""
       End With
       Selection.TypeText Text:=vbTab
    End Sub
    Gary
    Last edited by Gary Frieder; 2011-03-28 at 22:32. Reason: Aded Code tags

  3. #3
    New Lounger
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Gary

    Thanks very much for your response. I just realised I could change the style on the normal dot and that would change it for all documents.

    However, I still cant get it to put in a tab or indent the text after the footnote. I tried your code below, thanks for that, that does the job, as in it puts in the tab, so I think I am going to change the button so that people can click that instead to insert a footnote using your code. However your code still does not give it a hanging indent of 1.2. Would you know how to get that as well?

    Many thanks

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Glad that helped.

    The hanging indent setting is a property of the Footnote Text style; if you've set that in Normal.dot, it should then apply automatically to all new documents created from that point forward. But if you work in any documents created prior to your making the change in Normal.dot, these won't have the updated style property for Footnote Text.

    Options in that case might be (1) update the styles in the individual documents, or (2) add your original code that sets the properties for the Footnote Text style, into the code I provided - that way, it will both insert the tab after the footnote, and enforce the Footnote Text style formatting.

    Gary

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi all,

    I'd suggest a slightly different approach for generating the tab character:
    Code:
    Private Sub InsertFootnote()
    With Application.Dialogs(wdDialogInsertFootnote)
      If .Show <> -1 Then Exit Sub
      With Selection.Range
        .Start = .Start - 1
        .Characters.First.InsertBefore vbTab
        .Characters.Last = vbNullString
      End With
    End With
    End Sub
    This intercepts Word's Insert|Footnote dialogue box and, if you choose to insert either a footnote or endnote, replaces the standard space following the footnote/endnote number with a tab. In Word 2007, this means using the Insert|Footnote dropdown rather than simply clicking on the 'Insert Footnote' button or using the Ctrl-Alt-F keyboard shortcut (which could be reassigned to the macro anyway), but that's only one extra mouse click overall.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •