in case of a large list it is creating a text file but with no contents (size 0 Bytes). Any remedy or suggestions plz.
Private Sub cmdSave_Click() On Error GoTo errors123 If List1.ListCount = 0 Then MsgBox "Empty list cannot be exported." Exit Sub End If Dim i As Integer Dim objFSO As New Scripting.FileSystemObject Dim objTextFile As TextStream comdlg.CancelError = True comdlg.Flags = cdlOFNHideReadOnly + cdlOFNOverwritePrompt + cdlOFNPathMustExist comdlg.Filter = "Text File(*.txt)|*.txt|All Files(*.*)|*.*" comdlg.InitDir = Text1.Text comdlg.ShowSave strEmpFileName = comdlg.FileName Set objTextFile = objFSO.CreateTextFile(strEmpFileName, ForAppending) For i = 0 To List1.ListCount - 1 objTextFile.WriteLine List1.List(i) Next objTextFile.Close Set objTextFile = Nothing Set objFSO = Nothing MsgBox "File successfully saved to " & vbCrLf & comdlg.FileName, vbInformation errors123: If Err.Number = 32755 Then comdlg.FileName = "" Exit Sub End If End Sub
Attached File(s)
-
List file names.zip (6.07K)
Number of downloads: 21

New Topic/Question
Reply



MultiQuote





|