求助,数据不能保存
Private Sub Combo1_LostFocus()Dim i As Long, j As Integer, p As String
'以下为检查Combo1内是否有重复项目,无就添加
For i = 0 To Combo1.ListCount
If Combo1.List(i) = Combo1.Text Then
j = 1
Exit For
End If
Next
'如果无重复项目,向Combo1中添加数据,向文件中保存当前Combo1的项目便于下次启动时加载
If j = 0 Then
Combo1.AddItem Combo1.Text
For i = 1 To Combo1.ListCount
p = p & Combo1.List(i - 1) & Chr(13) & Chr(10)
'Next
Open a & "\myfile.DAT" For Output As #1
Print #1, Left(p, Len(p) - 2)
Close #1
Next
End If
End Sub
其中a= App.Path & "\"
奇怪的是,在设计当初是可以保存数据的,现在怎不能保存,不得其解,望各位老师指点