Text File Help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Text File Help

RonaldSRonaldS Posts: 33Member
The attached code does what I want it to do, but how can I re-save the text file without the double quotes? I tried saving as a text file, a .dat file and as a Word .doc file. All 3 give me the double quotes at the beginning and end of each file.

[code]
Private Sub BeginHere_Click()
Dim TextLine As String
Dim x1 As Long
Dim NumLines As Long
NumLines = Val(NumPages) * 57
ReDim x(1 To NumLines)
Dim FileNom As String
FileNom = NameOfFile.Text
Open "c:UsersRonDesktop" & FileNom & ".txt" For Input As #1
For x1 = 1 To NumLines
Line Input #1, TextLine
If EOF(1) Then Exit For
If Right(TextLine, 1) <> " " Then TextLine = TextLine + " "
x(x1) = TextLine
Label2.Caption = Str(NumLines)
Next x1
Close #1
'-------------------------------------------------------------
Open "c:UsersRonDesktop" & FileNom & ".txt" For Output As #1
For x1 = 1 To NumLines
Write #1, x(x1)
Label2.Caption = Str(NumLines)
Next x1
Close #1
End Sub
[/code]

Comments

  • lionblionb Posts: 1,688Member ✭✭
    : The attached code does what I want it to do, but how can I re-save
    : the text file without the double quotes? I tried saving as a text
    : file, a .dat file and as a Word .doc file. All 3 give me the double
    : quotes at the beginning and end of each file.
    :
    : [code]:
    : Private Sub BeginHere_Click()
    : Dim TextLine As String
    : Dim x1 As Long
    : Dim NumLines As Long
    : NumLines = Val(NumPages) * 57
    : ReDim x(1 To NumLines)
    : Dim FileNom As String
    : FileNom = NameOfFile.Text
    : Open "c:UsersRonDesktop" & FileNom & ".txt" For Input As #1
    : For x1 = 1 To NumLines
    : Line Input #1, TextLine
    : If EOF(1) Then Exit For
    : If Right(TextLine, 1) <> " " Then TextLine = TextLine + " "
    : x(x1) = TextLine
    : Label2.Caption = Str(NumLines)
    : Next x1
    : Close #1
    : '-------------------------------------------------------------
    : Open "c:UsersRonDesktop" & FileNom & ".txt" For Output As #1
    : For x1 = 1 To NumLines
    : Write #1, x(x1)
    : Label2.Caption = Str(NumLines)
    : Next x1
    : Close #1
    : End Sub
    : [/code]:
    [color=Blue]Use statement 'Print' instead of 'Write'
    [b]Print[/b] #1, x(x1)[/color]
Sign In or Register to comment.