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 lngUpdateTOC(strDoc As String) As Long
' Procedure :   lngUpdateTOC
' Description:  Return the number of updated TableOfContents in a document.
' Copyright: Chris Greaves
' Inputs:       A document name.
' Action:       None.
' Returns:      The number of pages in the document.
' Assumes:      The document is open.
' Side Effects: Every TOC will be updated; repagination may occur.
' Tested:       By the calls shown below.
   Dim lngCount As Long ' How many TOCs do we have in this document?
   lngCount = Documents(strDoc).TablesOfContents.Count
   If lngCount < 1 Then
   Else
      If lngCount > 1 Then
      Else
         Dim lngPos As Long ' Position of each TOC
         For lngPos = 1 To lngCount
            Documents(strDoc).TablesOfContents(lngPos).Update
         Next lngPos
      End If
   End If
   lngUpdateTOC = lngCount ' return the count of TOCs
'Private Sub TESTlngUpdateTOC()
'    MsgBox lngUpdateTOC(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

 

 

Hosted by www.Geocities.ws

1

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 lngUpdateTOC(strDoc As String) As Long
' Procedure :   lngUpdateTOC
' Description:  Return the number of updated TableOfContents in a document.
' Copyright: Chris Greaves
' Inputs:       A document name.
' Action:       None.
' Returns:      The number of pages in the document.
' Assumes:      The document is open.
' Side Effects: Every TOC will be updated; repagination may occur.
' Tested:       By the calls shown below.
   Dim lngCount As Long ' How many TOCs do we have in this document?
   lngCount = Documents(strDoc).TablesOfContents.Count
   If lngCount < 1 Then
   Else
      If lngCount > 1 Then
      Else
         Dim lngPos As Long ' Position of each TOC
         For lngPos = 1 To lngCount
            Documents(strDoc).TablesOfContents(lngPos).Update
         Next lngPos
      End If
   End If
   lngUpdateTOC = lngCount ' return the count of TOCs
'Private Sub TESTlngUpdateTOC()
'    MsgBox lngUpdateTOC(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

 

 

Hosted by www.Geocities.ws

1