Results 1 to 4 of 4

Thread: [RESOLVED] sorting record in Listbox

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    2

    Resolved [RESOLVED] sorting record in Listbox

    Hi guys and gurus, i'm new to VB programming so please bare with me

    i'm making a MACRO shortcut in MSWord which will invoke name of people. I'm using the bundled VB program of MSWord under macros. My problem is, how would i be able to show the names in alphabetical order?.. here's my simple program for a simple minded like me

    C:\Refer\Refer01.txt (input)

    Poohkyaw, Many
    Yu, Ester
    Polopot, Patty

    Listbox1 (output)

    Polopot, Patty
    Poohkyaw, Many
    Yu, Ester


    VB Code:
    1. Private Sub UserForm_Initialize()
    2.     Open "C:\Refer\Refer01.txt" For Input As #1
    3.     Do While Not EOF(1)
    4.         i = 0
    5.         Line Input #1, inputline$
    6.         ListBox1.AddItem inputline$, i
    7.     Loop
    8.     ListBox1.Text = ListBox1.List(1, 0)
    9.     Close 1
    10. End Sub

    How should i go about this?

    thanks in advance guys..
    Last edited by spectator; Feb 2nd, 2007 at 04:03 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width