You forgot Next l before End If
Block If without End If
i cannot seem to find the problem
Public Sub SaveData(LV As ListView, FilePath As String)
Dim l As Long, intFF As Integer
intFF = FreeFile
With LV
If .ListItems.Count > 0 Then
Open FilePath For Append As #intFF
For l = 1 To .ListItems.Count
Print #intFF, .ListItems(l).Text & ";" & .ListItems(l).SubItems(1) & .ListItems(1).SubItems(2) & ";" & .ListItems(1).SubItems(3) & ";" & .ListItems(1).SubItems(4) & ";" & .ListItems(1).SubItems(5)
Close #intFF
End If
End With
End Sub
You forgot Next l before End If
Code:Public Sub SaveData(LV As ListView, FilePath As String) Dim l As Long, intFF As Integer intFF = FreeFile With LV If .ListItems.Count > 0 Then Open FilePath For Append As #intFF For l = 1 To .ListItems.Count Print #intFF, .ListItems(l).Text & ";" & .ListItems(l).SubItems(1) & .ListItems(1).SubItems(2) & ";" & .ListItems(1).SubItems(3) & ";" & .ListItems(1).SubItems(4) & ";" & .ListItems(1).SubItems(5) Next 'l Close #intFF End If End With End Sub
Perhaps OP should loop from 0 to .ListItems.Count - 1 ?
DarkByte(06-19-2013)
That would not error though just loop 1 less than it should but yeah he should.
.count starts from 1
.index starts from 0
What part are you struggling with , He said his ide is giving him an error. The ide would not error for that reason.
Zachafer (06-22-2013)