This topic is now archived and is closed to further replies.

How to remove ("") in text file using VB?

This topic is 5871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i am a beginner on Visual Basic. I use open "test.txt" for output as #1 write #1, "testing" close #1 but the text file is ("testing"). How can i remove the ("") Thx a lot of! ^^

Share this post

Link to post
Share on other sites
There''s a number of different ways a file can be opened, check up on the VB help for Open.

For more control, it''s sometimes better to open the file in binary mode:

''don''t hardcode file handle numbers e.g. #1,
''better to use freefile to give you an available handle
Dim hFile As Long

hFile = FreeFile
Open "test.txt" For Binary Access Write As #hFile
Put #hFile, , "testing"
Close #hFile

In binary you will have to put in things like carriage return line feed characters yourself, e.g.:

Put #hFile, , "testing1" & vbCrlf
Put #hFile, , "testing2" & vbCrlf

Share this post

Link to post
Share on other sites