Results 1 to 7 of 7
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    field: footnotes (count) (Word any)

    Is it possible to use a field code to obtain the count of paragraphs in a footnote?

    I have an invoice with a table into which are typed the number of days. The remaining cells hold rate, net, tax, gross total calculations.
    Details of work are held briefly as footnotes, specifically a multi-paragraph footnote, one paragraph per day's work.
    The following VBA code currently loads the count of paragraphs (=days work) in the first footnote, into a table cell.
    <pre>Private Sub Document_Open()
    Selection.WholeStory
    Selection.Fields.Update
    Selection.HomeKey Unit:=wdStory
    ActiveDocument.Tables(1).Rows(2).Cells(2).Select
    Selection.TypeText (ActiveDocument.Footnotes(1).Range.Paragraphs.Count)
    End Sub</pre>

    I find myself wondering if a field code might provide a VBA-less mechanism, but (in Word 2003) can find not even a HINT of a field for footnotes, count or whatever.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: field: footnotes (count) (Word any)

    No, fields don't do that.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: field: footnotes (count) (Word any)

    >No, fields don't do that.
    (sigh) I thought as much or as little.
    I had this vague idea of moving some automation out of tinny little macros (set security to Low, ....) into non-toxic field codes.

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

    Re: field: footnotes (count) (Word any)

    Hi Chris,

    Your code could be made more efficient, however:

    <code>Private Sub Document_Open()
    With ActiveDocument
    .Fields.Update
    .Tables(1).Cell(2, 2).Range.Select
    Selection.TypeText (ActiveDocument.Footnotes(1).Range.Paragraphs.Coun t)
    End With
    End Sub</code>
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: field: footnotes (count) (Word any)

    If you want to get even more efficient you could save another ActiveDocument with
    <pre>Private Sub Document_Open()
    With ActiveDocument
    .Fields.Update
    .Tables(1).Cell(2, 2).Range.text = .Footnotes(1).Range.Paragraphs.count
    End With
    End Sub</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

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

    Re: field: footnotes (count) (Word any)

    Even more importantly, that eliminates an unnecessary selection. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: field: footnotes (count) (Word any)

    Thank you both!

Posting Permissions

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