|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function lngCountLinesInTOC(strDoc As String) As Long
' Procedure : lngCountLinesInTOC
' Description: Count all the lines in all the table of contents in the named document.
' Copyright: Chris Greaves Inc.
' Inputs: String document name
' Returns: Boolean
' Assumes: Nothing
' Side Effects: None.
' Tested: By the calls shown below.
Dim rng As Word.Range
Dim fld As Word.Field
Dim lngRes As Long
For Each fld In Documents(strDoc).Fields
If fld.Type = wdFieldTOC Then
Set rng = fld.Result
lngRes = lngRes + rng.ComputeStatistics(wdStatisticLines)
End If
Next fld
lngCountLinesInTOC = lngRes
'Sub TESTlngCountLinesInTOC()
' MsgBox lngCountLinesInTOC(ActiveDocument.Name)
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |