Opps. You need to clear your string each time:
VB Code:
Dim intNumberOfRows As Integer Dim intNumberOfColumns As Integer Dim strLineText As String intNumberOfRows = 5 intNumberOfColumns = 2 For x = 1 To intNumberOfRows strLineText = "" For y = 1 To intNumberOfColumns strLineText = strLineText & Chr(34) & Cells(x, y) & Chr(34) & "," Next y strLineText = "new Array(" & Left$(strLineText, Len(strLineText) - 1) & ")" If x < intNumberOfRows Then strLineText = strLineText & "," strLineText = strLineText & vbNewLine txtfile.write strLineText Next x




Reply With Quote