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 strFieldNames(doc As Document, intFieldType As Integer) As String
' Procedure :   strFieldNames
' Description:  Return a string with the names of all {Index} table names in the document.
' By:           Chris Greaves Inc.
' Inputs:       DOCUMENT to be examined.
' Returns:      None.
' Assumes:      None.
' Side Effects: None
' Tested:       By the calls below.
    Dim strResult As String
    strResult = " "
    Dim fld As Field
    For Each fld In doc.Fields
        If fld.Type = intFieldType Then
            Dim strFieldCodeText As String
            strFieldCodeText = UCase(fld.Code.Text)
            Dim iInstr As Integer
            iInstr = InStr(1, strFieldCodeText, "\F")
            If iInstr > 0 Then
                Dim strName As String
                strName = Trim(Right$(strFieldCodeText, Len(strFieldCodeText) - iInstr - 1))
                strName = Left$(strName, 1)
                If InStr(1, strResult, strName) = 0 Then
                   strResult = strResult & strName
                 Else
                 End If
            Else
            End If
        Else
        End If
    Next fld
    strFieldNames = strResult
'Sub TESTstrFieldNames()
'MsgBox strFieldNames(ActiveDocument, wdFieldIndex)
'MsgBox strFieldNames(ActiveDocument, wdFieldIndexEntry)
'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 strFieldNames(doc As Document, intFieldType As Integer) As String
' Procedure :   strFieldNames
' Description:  Return a string with the names of all {Index} table names in the document.
' By:           Chris Greaves Inc.
' Inputs:       DOCUMENT to be examined.
' Returns:      None.
' Assumes:      None.
' Side Effects: None
' Tested:       By the calls below.
    Dim strResult As String
    strResult = " "
    Dim fld As Field
    For Each fld In doc.Fields
        If fld.Type = intFieldType Then
            Dim strFieldCodeText As String
            strFieldCodeText = UCase(fld.Code.Text)
            Dim iInstr As Integer
            iInstr = InStr(1, strFieldCodeText, "\F")
            If iInstr > 0 Then
                Dim strName As String
                strName = Trim(Right$(strFieldCodeText, Len(strFieldCodeText) - iInstr - 1))
                strName = Left$(strName, 1)
                If InStr(1, strResult, strName) = 0 Then
                   strResult = strResult & strName
                 Else
                 End If
            Else
            End If
        Else
        End If
    Next fld
    strFieldNames = strResult
'Sub TESTstrFieldNames()
'MsgBox strFieldNames(ActiveDocument, wdFieldIndex)
'MsgBox strFieldNames(ActiveDocument, wdFieldIndexEntry)
'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