Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-07-2022, 11:05 AM
grNadpa grNadpa is offline Please confirm write # and print # are my only text file output options Windows 10 Please confirm write # and print # are my only text file output options Office 2016
Advanced Beginner
Please confirm write # and print # are my only text file output options
 
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
Reply

Tags
output to file, vba, word 2016



Similar Threads
Thread Thread Starter Forum Replies Last Post
Please confirm write # and print # are my only text file output options Print options - Staples alive15 Word 1 12-01-2017 05:14 PM
Print output on a long report is too small jood Excel 5 10-19-2015 07:27 PM
Please confirm write # and print # are my only text file output options Read text Report file with VBA and write parsed fields to Excel workbook tpcervelo Excel Programming 1 01-05-2012 10:14 PM
Having to Confirm SQL Command mrdavie Mail Merge 0 02-24-2011 04:38 PM
Please confirm write # and print # are my only text file output options Print only images or only text in word file mrj1233 Drawing and Graphics 1 01-17-2011 10:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft