SirCurious_VBAExcel
New Member
- Joined
- Sep 30, 2014
- Messages
- 17
Hello, All,
I need help resolving a Print #1 issue. My code is written to export a text file based on a list box's results - it should only be printing 200 results. The issue is the exported text file contains only 199 (the 200th result appears as a blank line) - any suggestions?
My export subroutine:
(Public variable; "Dim ListArray(200) As Variant")
I need help resolving a Print #1 issue. My code is written to export a text file based on a list box's results - it should only be printing 200 results. The issue is the exported text file contains only 199 (the 200th result appears as a blank line) - any suggestions?
My export subroutine:
(Public variable; "Dim ListArray(200) As Variant")
Code:
Private Sub Export_Click()
Dim OutCount As Integer
Dim OutFile As Variant
If ItemCount > 0 Then
OutFile = Application.GetSaveAsFilename(fileFilter:="Text File(*.txt),*.txt")
If OutFile <> False Then
MsgBox "Save as" & OutFile
End If
Open OutFile For Output As #1
For OutCount = 1 To ItemCount
If OutCount < 201 Then
Print #1, ListArray(OutCount)
End If
Next
Close #1
If ItemCount > 200 Then
MsgBox ("Warning - list incomplete - only contains first 200 entries")
End If
End If
End Sub
Last edited by a moderator: