Code:Private Sub CheckStartList() Dim a As Integer If Option1(2).Value Then start_tag = Val(Text1(8)) For a = 0 To List1(aa).ListCount - 1 If List1(aa).List(a) > Val(start_tag) Then getStart = a Exit Sub Else getStart = -1 End If Next End If If Option2(0).Value Then start_tag = Val(Text1(8)) For a = 0 To List1(aa).ListCount - 1 If List1(aa).List(a) < Val(start_tag) Then getStart = a Exit Sub Else getStart = -1 End If Next End If End Sub Private Sub CheckStopList() Dim a, b As Integer If Option1(3).Value Then stop_tag = Val(Text1(9)) For a = 0 To List1(aa).ListCount - 1 If List1(aa).List(a) > Val(stop_tag) Then If a > 0 Then getStop = a - 1 If a = 0 Then getStop = 0 If getStop >= getStart Then Exit Sub Else getStop = List1(aa).ListCount - 1 End If Next End If If Option2(1).Value Then stop_tag = Val(Text1(9)) For a = 0 To List1(aa).ListCount - 1 If List1(aa).List(a) < Val(stop_tag) Then If a > 0 Then getStop = a - 1 If a = 0 Then getStop = 0 If getStop >= getStart Then Exit Sub Else getStop = List1(aa).ListCount - 1 End If Next End If End Sub Private Sub SaveLogFile_TXT() If chk_startLogging.Value = 1 Then If Option4(1).Value Then num = 1 If cmb_channel.Text = "Channel 1" Then aa = 0 If cmb_channel.Text = "Channel 2" Then aa = 1 If cmb_channel.Text = "Channel 3" Then aa = 2 If cmb_channel.Text = "Channel 4" Then aa = 3 If cmb_channel.Text = "Channel 5" Then aa = 4 If cmb_channel.Text = "Channel 6" Then aa = 5 If cmb_channel.Text = "Channel 7" Then aa = 6 If cmb_channel.Text = "Channel 8" Then aa = 7 CheckStartList CheckStopList If List1(aa).List(0) <> "" Then If getStart = -1 Then Close #3 Exit Sub End If For c = getStart To getStop Print #3, Format(num, "00000"); For b = 0 To 7 Print #3, Right$(Space(8) & List1(b).List©, 8); Next b Print #3, num = num + 1 Next End If Close #3 Exit Sub End If End If End Sub
when running the code,there is no error...but sometimes the result is not correctly.....
i think the problem is inside the "CheckStartList" or "CheckStopList".....





Reply With Quote