Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Sep 2004
    Location
    Evesham, Worcestershire, England
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sort order (VBScript)

    I have a VBScript that I use to populate username dropdowns on our ASP intranet, with users details from Active Directory. The script uses LDAP to grab the user details. However, as the users are split into Organisational Units for each department the names come out in department groups rather than a simple alphabetical list. If I put the list of users into an array I could sort the array to get the order I want. However, I can't find a sort function for VBScript arrays. Is there one?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Sort order (VBScript)

    It is not built in to VB or VBScript, but you can use your own code to do the sorting. Here are some places to start looking for code; the usual changes between VBA and VBS (such as only using variants) will be required in most cases: Addressing a collection 'out of order' (VBA/PPT) and sort array (WordXP SP3)

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sort order (VBScript)

    See http://www.standards.com/index.html?Sorting for code for sorting algorithms.

  4. #4
    Lounger
    Join Date
    Sep 2004
    Location
    Evesham, Worcestershire, England
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sort order (VBScript)

    My problem is that the script is written in VBScript which doesn't seem to support the sort method. It another example of one of the differences between VBScript and VB or VBA.

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sort order (VBScript)

    you do not need the sort method.
    the code i posted shows how to write your own sorting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •