VB将list1中的内容写入到txt文件中
展开全部
Public Function CreateAfile(TxtName As String, StrD As String) As Boolean
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(TxtName, True)
a.WriteLine (StrD)
a.Close
If Err Then
CreateAfile = False
Else
CreateAfile = True
End If
End Function
Public Sub Seted(Show As Boolean)
Dim strs As String
If List1.ListCount > 0 Then
With List1
For w = .ListCount - 1 To 0 Step -1
If .Selected(w) Then
strs = strs & .List(w) & vbCrLf
Else
strs = strs & .List(w) & vbCrLf
End If
Next w
End With
End If
CreateAfile "路径加文件名", strs
End Sub
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(TxtName, True)
a.WriteLine (StrD)
a.Close
If Err Then
CreateAfile = False
Else
CreateAfile = True
End If
End Function
Public Sub Seted(Show As Boolean)
Dim strs As String
If List1.ListCount > 0 Then
With List1
For w = .ListCount - 1 To 0 Step -1
If .Selected(w) Then
strs = strs & .List(w) & vbCrLf
Else
strs = strs & .List(w) & vbCrLf
End If
Next w
End With
End If
CreateAfile "路径加文件名", strs
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
textbox1.text=list1.value
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询