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 lngUniqueStrings(ByVal str As String, strDels As String, strAr() As String, Optional boolCase As Boolean = False) As Long
' Procedure :   lngUniqueStrings
' Description:  Return a library of unique strings.
' Copyright:    Chris Greaves Inc.
' Inputs:       A string, a set of delimiters.
' Returns:      LONG number of unique strings obtained.
' Assumes:      None.
' Side Effects: The array strAr will be modified
' Tested:       By the calls shown below.
    str = strNot(str, Chr(13))
    Dim bool As Boolean
    bool = False
'    If IsMissing(boolCase) Then
'    Else
'        bool = boolCase
'    End If
    ReDim strAr(0) ' set our result array to be empty
    Dim strString As String
    While str <> "" ' until our data string is exhausted
        Dim lngSrce As Long
            strString = ""
        For lngSrce = 1 To Len(str)
            If InStr(1, strDels, Mid(str, lngSrce, 1)) > 0 Then ' we have found one of the delimiters in the source string
                strString = Left(str, lngSrce - 1)
                If strString <> "" Then
                    Call LoadUnique(strAr, strString, boolCase)
                Else
                End If
                str = Right(str, Len(str) - lngSrce)
                Exit For
            Else
            End If
        Next lngSrce
        If lngSrce > Len(str) And strString = "" Then
            strString = str
            Call LoadUnique(strAr, strString, boolCase)
            str = ""
        Else
        End If
    Wend
'    If UBound(strAr) > 0 Then
'        ReDim Preserve strAr(UBound(strAr) - 1)
'    Else
'    End If
    lngUniqueStrings = UBound(strAr)
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 lngUniqueStrings(ByVal str As String, strDels As String, strAr() As String, Optional boolCase As Boolean = False) As Long
' Procedure :   lngUniqueStrings
' Description:  Return a library of unique strings.
' Copyright:    Chris Greaves Inc.
' Inputs:       A string, a set of delimiters.
' Returns:      LONG number of unique strings obtained.
' Assumes:      None.
' Side Effects: The array strAr will be modified
' Tested:       By the calls shown below.
    str = strNot(str, Chr(13))
    Dim bool As Boolean
    bool = False
'    If IsMissing(boolCase) Then
'    Else
'        bool = boolCase
'    End If
    ReDim strAr(0) ' set our result array to be empty
    Dim strString As String
    While str <> "" ' until our data string is exhausted
        Dim lngSrce As Long
            strString = ""
        For lngSrce = 1 To Len(str)
            If InStr(1, strDels, Mid(str, lngSrce, 1)) > 0 Then ' we have found one of the delimiters in the source string
                strString = Left(str, lngSrce - 1)
                If strString <> "" Then
                    Call LoadUnique(strAr, strString, boolCase)
                Else
                End If
                str = Right(str, Len(str) - lngSrce)
                Exit For
            Else
            End If
        Next lngSrce
        If lngSrce > Len(str) And strString = "" Then
            strString = str
            Call LoadUnique(strAr, strString, boolCase)
            str = ""
        Else
        End If
    Wend
'    If UBound(strAr) > 0 Then
'        ReDim Preserve strAr(UBound(strAr) - 1)
'    Else
'    End If
    lngUniqueStrings = UBound(strAr)
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