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 PermuteList(ByVal strList As String, strWord As String)
' Procedure :   PermuteList
' Description:  Work towards a test of permutations of string characters
' Copyright: Chris Greaves Inc.
' Inputs:           List of strings, current word string.
' Returns:         None
' Assumes:      Nothing
' Side Effects: None.
' Tested:           By the calls shown below.
    If Len(strList) <= 1 Then ' list is empty, time to test the word
        Application.Caption = strWord
        If boolSpelling(strWord) Then ' The word is valid
            Dim strPhone As String
            strPhone = strGPA("Phone", strPhone)
            Call LogFile(MacroContainer.Path & Application.PathSeparator & strcApplication, strPhone & " " & strWord)
            Selection.TypeText strPhone & " " & strWord
            Selection.TypeParagraph
        Else ' the word is not valid
        End If
    Else ' Iterate through all characters of the first element of the list
    Dim strItem As String
    Dim strDelim As String
    strDelim = Left(strList, 1)
    strItem = strSplitStringAt(Right(strList, Len(strList) - 1), strDelim, True)
    If strItem = "" Then
        strItem = Right(strList, Len(strList) - 1)
    Else
    End If
    strList = strDelim & strSplitStringAt(Right(strList, Len(strList) - 1), strDelim, False)
    While Len(strItem) > 0
        Call PermuteList(strList, strWord & Left(strItem, 1))
        strItem = Right(strItem, Len(strItem) - 1)
    Wend
    End If
'Sub TESTPermuteList()
''    Call PermuteList("", "alphabet") ' empty list, word is valid
''    Call PermuteList("", "lphbt") ' empty list, word is INvalid
''
''    Call PermuteList(",123", "alphabet") ' single item list, word is valid
''    Call PermuteList(",123", "lphbt") '  single item  list, word is INvalid
'    Call PermuteList(",123,456,789", "alphabet") 'triple  item list, word is valid
'    Call PermuteList(",123,456,789", "lphbt") '  triple item  list, word is INvalid
'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 PermuteList(ByVal strList As String, strWord As String)
' Procedure :   PermuteList
' Description:  Work towards a test of permutations of string characters
' Copyright: Chris Greaves Inc.
' Inputs:           List of strings, current word string.
' Returns:         None
' Assumes:      Nothing
' Side Effects: None.
' Tested:           By the calls shown below.
    If Len(strList) <= 1 Then ' list is empty, time to test the word
        Application.Caption = strWord
        If boolSpelling(strWord) Then ' The word is valid
            Dim strPhone As String
            strPhone = strGPA("Phone", strPhone)
            Call LogFile(MacroContainer.Path & Application.PathSeparator & strcApplication, strPhone & " " & strWord)
            Selection.TypeText strPhone & " " & strWord
            Selection.TypeParagraph
        Else ' the word is not valid
        End If
    Else ' Iterate through all characters of the first element of the list
    Dim strItem As String
    Dim strDelim As String
    strDelim = Left(strList, 1)
    strItem = strSplitStringAt(Right(strList, Len(strList) - 1), strDelim, True)
    If strItem = "" Then
        strItem = Right(strList, Len(strList) - 1)
    Else
    End If
    strList = strDelim & strSplitStringAt(Right(strList, Len(strList) - 1), strDelim, False)
    While Len(strItem) > 0
        Call PermuteList(strList, strWord & Left(strItem, 1))
        strItem = Right(strItem, Len(strItem) - 1)
    Wend
    End If
'Sub TESTPermuteList()
''    Call PermuteList("", "alphabet") ' empty list, word is valid
''    Call PermuteList("", "lphbt") ' empty list, word is INvalid
''
''    Call PermuteList(",123", "alphabet") ' single item list, word is valid
''    Call PermuteList(",123", "lphbt") '  single item  list, word is INvalid
'    Call PermuteList(",123,456,789", "alphabet") 'triple  item list, word is valid
'    Call PermuteList(",123,456,789", "lphbt") '  triple item  list, word is INvalid
'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