Hi,

I am trying to read in a text file to a ListBox and have the ability to delete a row or rows in the listbox and then re-write the text file with the changes. Here is my code that works, but sometimes it deletes the very first row instead of the one I selected from the listbox, but not always. I must have something wrong with my code....

Private Sub CommandButton2_Click()

ListIndex = 1 'First Item is list
ListBox1.RemoveItem (ListBox1.ListIndex)

MyFile = "c:\temp2\" & txtCCA & ".txt"

Open MyFile For Output As #1:
Print #1, Me.ListBox1.Value

Close #1
Me.txtComments.Value = vbNullString
End Sub
Thanks for any help you can provide!