G
gravesen
HI with some help from the lidt I got following code and it is no
almost working now. There two small things I would like to do
This is the code that reads the text file and sends it to m
textboxes:
-------------------------------------------------
Private Sub UserForm_Activate()
Dim iLin As Integer ' a counter for lines
Dim sTxt As String ' the text from a line
Open "c:\test\address.txt" For Input As #1
For iLin = 1 To 2 ' in case there are 5 lines
Input #1, sTxt ' get the text from the line
' MsgBox sTxt ' for testing
Input #1, sTxt
TextBox1.Text = sTxt
Input #1, sTxt
TextBox2.Text = sTxt
Input #1, sTxt
TextBox3.Text = sTxt
Input #1, sTxt
TextBox4.Text = sTxt
Input #1, sTxt
TextBox5.Text = sTxt
Next
' or
'Input #1, sTxt
'TextBox2.Text = sTxt
'...
Close #1
End Sub
---------------------------------
The first thing is that when I read from the text file it is like th
program doen't take the first line of text but if I leave a blank spac
I get errors.
I have this as test in my txt file.
--------------------------
1,1a, 1a, 1c, 1d, 1e, 1f
Lars Gravesen
Next line of text
3 line
4 line
5 line
6 line
---------------------------------------
The first line is not inserted in any textbox but if I delete it I ge
errors.
Also I would like to insert multiple line i a textbox but how can
tell this to the textbox in my txt file??
Any help would be so nice
Thanks
Lars Gravese
almost working now. There two small things I would like to do
This is the code that reads the text file and sends it to m
textboxes:
-------------------------------------------------
Private Sub UserForm_Activate()
Dim iLin As Integer ' a counter for lines
Dim sTxt As String ' the text from a line
Open "c:\test\address.txt" For Input As #1
For iLin = 1 To 2 ' in case there are 5 lines
Input #1, sTxt ' get the text from the line
' MsgBox sTxt ' for testing
Input #1, sTxt
TextBox1.Text = sTxt
Input #1, sTxt
TextBox2.Text = sTxt
Input #1, sTxt
TextBox3.Text = sTxt
Input #1, sTxt
TextBox4.Text = sTxt
Input #1, sTxt
TextBox5.Text = sTxt
Next
' or
'Input #1, sTxt
'TextBox2.Text = sTxt
'...
Close #1
End Sub
---------------------------------
The first thing is that when I read from the text file it is like th
program doen't take the first line of text but if I leave a blank spac
I get errors.
I have this as test in my txt file.
--------------------------
1,1a, 1a, 1c, 1d, 1e, 1f
Lars Gravesen
Next line of text
3 line
4 line
5 line
6 line
---------------------------------------
The first line is not inserted in any textbox but if I delete it I ge
errors.
Also I would like to insert multiple line i a textbox but how can
tell this to the textbox in my txt file??
Any help would be so nice
Thanks
Lars Gravese