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 lngIndexToListBox(lb As ListBox, strText As String, Optional blnCaseSensitive As Boolean = False) As Long
' Procedure :   lngIndexToListBox
' Description:  Return the ListIndex of a string in a Listbox.
' Copyright:    Chris Greaves Inc.
' Inputs:       None
' Returns:      LONG -1 if not found
' Assumes:      Nothing
' Side Effects:
' Tested:       By a call from the user.
'gwhitfield replied to your post on the VB / VBA board at the Woody's Lounge site:
''Re: Code: Function lngIndexToListBox(lb As ListBox, st'.
'http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=vb&Number=26786
    lngIndexToListBox = -1 ' default result is failure
    Dim lngI As Long ' loop counter
    For lngI = 0 To lb.ListCount - 1
        If blnCaseSensitive Then
            If lb.List(lngI) = strText Then
                lngIndexToListBox = lngI
                Exit For
            Else
            End If
        Else
            If UCase(lb.List(lngI)) = UCase(strText) Then
                lngIndexToListBox = lngI
                Exit For
            Else
            End If
        End If
    Next lngI
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 lngIndexToListBox(lb As ListBox, strText As String, Optional blnCaseSensitive As Boolean = False) As Long
' Procedure :   lngIndexToListBox
' Description:  Return the ListIndex of a string in a Listbox.
' Copyright:    Chris Greaves Inc.
' Inputs:       None
' Returns:      LONG -1 if not found
' Assumes:      Nothing
' Side Effects:
' Tested:       By a call from the user.
'gwhitfield replied to your post on the VB / VBA board at the Woody's Lounge site:
''Re: Code: Function lngIndexToListBox(lb As ListBox, st'.
'http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=vb&Number=26786
    lngIndexToListBox = -1 ' default result is failure
    Dim lngI As Long ' loop counter
    For lngI = 0 To lb.ListCount - 1
        If blnCaseSensitive Then
            If lb.List(lngI) = strText Then
                lngIndexToListBox = lngI
                Exit For
            Else
            End If
        Else
            If UCase(lb.List(lngI)) = UCase(strText) Then
                lngIndexToListBox = lngI
                Exit For
            Else
            End If
        End If
    Next lngI
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