I have a handy class I use for listboxes. Someone gave it to me long ago on SD.
(you need an account to see links)
Add it to the project.
Add the Microsoft Common Dialog Control Component 6.0. (Add it to the form and name it 'comDia')
Add this code to the very top of your code.
Code:
Dim clsList As New clsList
Add this code to your Form_Load
Code:
clsList.BindList yourlistbox
And for loading and saving, use these, you can change them around a little bit.
Code:
Private Sub cmdLoad_Click()
On Error GoTo ErrHand
With comDia
.DialogTitle = "Load List"
.Filter = "Text Files|*.txt"
.CancelError = True
.ShowOpen
clsList.LoadListFromFile .FileName
End With
ErrHand:
End Sub
Private Sub cmdSave_Click()
On Error GoTo ErrHand
With comDia
.DialogTitle = "Save List"
.Filter = "Text Files|*.txt"
.CancelError = True
.ShowSave
If Dir(.FileName) <> "" Then
ans = MsgBox("The file " & .FileTitle & " already exists." & vbCrLf & _
"Are you sure you want to overwrite it?", vbYesNo, "Confirm Overwrite")
If ans = vbNo Then Exit Sub
End If
clsList.SaveListToFile .FileName
End With
ErrHand:
End Sub
End Sub