View Single Post
 
Old 11-07-2022, 11:05 AM
grNadpa grNadpa is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Mar 2022
Posts: 46
grNadpa is on a distinguished road
Default Please confirm write # and print # are my only text file output options

My problem is that write # appears to embed each record in quotation marks unless I end the command with a semicolon. The issue there is that the record itself contains semicolons.
The print # takes care of that issue but appears to create an empty record at the end of the file. (i.e. an extra vbCrLf)
The workaround is straight forward
Code:
     varRoster = Input(LOF(lngFile), lngFile)
' render records as an array
    arrRoster = Split(varRoster, vbCrLf)
' Using Print # command to save file unavoidably
' creates extra vbCrLf at end of file
    If Len(arrRoster(UBound(arrRoster))) < 1 Then
        ReDim Preserve arrRoster(UBound(arrRoster) - 1)
    End If
That works. But I’d prefer an option to avoid this editing entirely if there is one.
(Note: the rest of the application uses arrRoster, so I am not splitting the variant to an array simply for this purpose)

Last edited by grNadpa; 11-07-2022 at 11:14 AM. Reason: Clarify that the split reason
Reply With Quote