By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,404 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,404 IT Pros & Developers. It's quick & easy.

writing multiple text boxes to one file

P: 8
hi, im having problems writing multiple text boxes in one file.

i`ve got a code, but its stands for save only, and delete any previous information from the file.

my code:
private sub command1_click()
Dim sTextMixed As String
'Mixing the textboxes
sTextMixed = Text5.Text & vbCrLf & Text4.Text
'Saving it
Open "C:\sample.txt" For Output As #1
Print #1, sTextMixed
Close #1
end sub

i`d like to write about 8-15 text box`s several times, and i want each at the end/bottom of the txt file.

or

saving the text boxes in one file, and adding the content of the file to the end of another.

hope you can help me about this..
Jan 27 '12 #1

✓ answered by Guido Geurs

Use the "Append" mode in "Open" =>
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim FILEnmr As Integer
  3.     FILEnmr = FreeFile
  4.     Open App.Path & "\test.txt" For Append As #FILEnmr
  5.         Print #FILEnmr, Text1.Text
  6.     Close #FILEnmr
  7. End Sub

Share this Question
Share on Google+
2 Replies


Guido Geurs
Expert 100+
P: 767
Use the "Append" mode in "Open" =>
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim FILEnmr As Integer
  3.     FILEnmr = FreeFile
  4.     Open App.Path & "\test.txt" For Append As #FILEnmr
  5.         Print #FILEnmr, Text1.Text
  6.     Close #FILEnmr
  7. End Sub
Jan 28 '12 #2

P: 8
thanks alot, it worked!
Jan 28 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.