Dim Log As Integer Dim LogFile As String Dim i As Integer Dim AllStr As String LogFile = Trim(App.Path & "\" & Trim(Str(Replace(Format(Now, "yyyy-mm-dd"), "-", "")) & Replace((Time), ":", "") & ".log")) AllStr = "" For i = 0 To List1.ListCount - 1 '修改这地方I的值,自己看着办 AllStr = AllStr & List1.List(i) & vbCrLf Next
Dim LogFile As String
Dim i As Integer
Dim AllStr As String
LogFile = Trim(App.Path & "\" & Trim(Str(Replace(Format(Now, "yyyy-mm-dd"), "-", "")) & Replace((Time), ":", "") & ".log"))
AllStr = "" For i = 0 To List1.ListCount - 1 '修改这地方I的值,自己看着办
AllStr = AllStr & List1.List(i) & vbCrLf
Next
Log = WritePrivateProfileString(Now, "日志内容", AllStr, LogFile) '这是一个API函数
If AllStr <> "" Then
If Log = 0 Then
MsgBox "导出失败!", , "错误"
Else
MsgBox "导出成功!", , "提示"
End If
Else
MsgBox "当前没有日志需要导出!", , "提示"
End If