Hello all, I have a VB Script that creates a phone list for my company, and I have been asked to alphabetize the names listed under the department headings....I am so new to VB that this is the first time I have used it.....ever I've done a great deal of searching, and have yet to find an answer, I was hopeing someone would help.

my code currently looks like this:

Sub EnumerateUsers(oCont)
    
    Dim oUser
    
    For Each oUser In oCont
    
    Select Case LCase(oUser.Class)
        Case "user"
            If oUser.telephoneNumber <> "" then
            If oUser.physicalDeliveryOfficeName = "Wixom" then
              
                If oUser.department = "Engineering" then
                    
                    sdata = "<tr>"
                    sdata = sdata & "<td class='list'>" & oUser.GivenName & " " & oUser.SN & "</td>"
                    sdata = sdata & "<td class='list'>" & oUser.telephoneNumber & "</td>"
                    sdata = sdata & "</tr>"
                    
                    wixEng(wixEngRow) = sdata
                    wixEngRow = wixEngRow + 1
                    
                 end if
"... there are tons more like this in this sub.... but it ends like this..."

end if
               
               Case "organizationalunit", "container"
                    EnumerateUsers oUser
                    
        End Select

So I want to do something similar to the SQL OrderBy, but I can't find the syntax... Does anyone have an Idea for me?

Thanks in advance!

what have you used as a container for your phonebook entries?

is it a <select> tag in HTML (means listbox)???
if its so then I think there is an attribute called "Sorted" . make its value to True like this :-

<select sorted name="phonelist" size=10>

what have you used as a container for your phonebook entries?

is it a <select> tag in HTML (means listbox)???
if its so then I think there is an attribute called "Sorted" . make its value to True like this :-

<select sorted name="phonelist" size=10>

The entries are coming from my Active Directory LDAP server, and a GetObject function is being used to get all the entries from AD, and they are coming in sorted alphabetically, but by container (i.e. the Domain Admins container is first, and all names in that container are sorted, then comes the users container etc...)
There fore when the entries are being processed by the script, and added to the variables, they are not necessarily alphabetic

So I found something called QuickSort
but all the examples I found had a new sub created and it was all described using intergers, which I can't seem to comprehend and convert to strings in my head....so does anyone know if I can use Quciksort with Text? I have purchased a refernce book, but I wont get it in the mail until next week sometime...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.