Hi Fred
You can't do it without writing some code. If you've some Word macro
experience I'll explain what you need to do, it's not particularly
difficult:
Insert a bookmark in the table, preferably in the header row, somewhere
where it wont get deleted. If you don't have a header row in your table
just bookmark the ENTIRE table. Lets call the bookmark "TableToRowCount".
There's a number of different ways to achieve the next step but we'll use a
Docvariable field. Where you want the text "N Entries" insert a Docvariable
field: Insert>Field>Docvariable. In the Field dialog box after the text
DOCVARIABLE type "RowCount". Now add the text " Entries" after the field.
Now add the following Macro to the documents template:
Public Sub CountRows()
Const cBMName As String = "TableToRowCount"
Const cDVName As String = "RowCount"
Dim lngRows As Long
Dim strValue As String
' Find out the number of rows in the required table
With ActiveDocument.Bookmarks
If .Exists(cBMName) Then
lngRows = .Item(cBMName).Range.Tables(1).Rows.Count
Else
MsgBox "The current document does not contain the " & _
"expected bookmark: " & cBMName, vbExclamation
Exit Sub
End If
End With
' Find out if the Document Variable exists
On Error Resume Next
strValue = ActiveDocument.Variables(cDVName)
If Err.Number <> 0 Then
' It doesn't exist so create it
On Error GoTo 0
ActiveDocument.Variables.Add cDVName, CStr(lngRows)
Else
' Update existing variables
ActiveDocument.Variables(cDVName).Value = CStr(lngRows)
End If
' Update all fields in the BodyText part of the document
ActiveDocument.Fields.Update
End Sub
Now all you need is a way of triggering the macro so that it update the
DocumentVariable and the fields that displays the document variable value.
What I've done is create a custom macro to intercept the Word Save command:
Sub FileSave()
ActiveDocument.Save
CountRows
End Sub
So your displayed row count gets updated every time you save your document.
HTH + Cheers - Peter