ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delimiter (https://www.excelbanter.com/excel-programming/379686-delimiter.html)

hughie

delimiter
 
Having output text from a dos batch file, I read it back into a text
box on a userform thus:

Open fileName For Input As #1
Do While Not EOF(1)
Input #1, x
str = str & x & vbCrLf
Loop

...and then send 'str' back as the result of a function.

When the file has commas in it, the text box reads them as line breaks.
Does anyone know how to stop this?

tia,
Hughie


NickHK

delimiter
 
Hughie,
Maybe getting the whole file in one go is suitable ?

Dim FileNum As Long
Dim FileStr As String

FileNum = FreeFile
Open "C:\Test.txt" For Input As FileNum
FileStr = Input$(LOF(FileNum), #FileNum)
Close #FileNum

Debug.Print FileStr

NickHK

"hughie" wrote in message
ps.com...
Having output text from a dos batch file, I read it back into a text
box on a userform thus:

Open fileName For Input As #1
Do While Not EOF(1)
Input #1, x
str = str & x & vbCrLf
Loop

..and then send 'str' back as the result of a function.

When the file has commas in it, the text box reads them as line breaks.
Does anyone know how to stop this?

tia,
Hughie




hughie

delimiter
 
Try

line input #1, x

and thatshould read lines.


yup! :)

thanks very much,
Hughie



All times are GMT +1. The time now is 05:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com