Hello,
I just started programming in VBA please bear with me if this question is too basic.
I’ve got a bunch of textboxes and I want to read the values of these boxes into a comma separated text file. So far I’ve got this
This works fine but this is with only one textbox I’ve got a lot more and therefore I would like to have some kind of loop which loops trough all the textboxes and writes the values to the comma separated text file. Is this possible? And if so how?Code:Private Sub CommandButton1_Click() dDate = DateSerial(Year(Date), Month(Date), Day(Date)) 'Open browse window om bestand te selecteren NewFN = Application.GetSaveAsFilename("C:\Documents and Settings\Test", "Text File (*.txt), *.txt") sFile = NewFN If NewFN = False Then Exit Sub Else Dim cCont As Control Dim vaFields As Variant 'set and open file for output FNum = FreeFile() Open NewFN For Append As FNum Print #FNum, dDate; ","; TextBox1.Text Close #FNum End If End Sub
Barry




Reply With Quote