ProgramRasta
Member
- Local time
- Today, 15:36
- Joined
- Feb 27, 2020
- Messages
- 98
Hello All,
I was wondering is it possible to adjust the horizontal spacing in a newly created text file. Each of the table columns is separated by a space - what I am trying to achieve is to increase the length of the space. Importantly, the format has to remain unchanged i.e. it needs to remain one space.
Thanks for your time
I was wondering is it possible to adjust the horizontal spacing in a newly created text file. Each of the table columns is separated by a space - what I am trying to achieve is to increase the length of the space. Importantly, the format has to remain unchanged i.e. it needs to remain one space.
Code:
Set rstTableToExportRecords = dbs.OpenRecordset(strTable, dbOpenDynaset)
Set fsoFileSystem = New Scripting.FileSystemObject
Set tsoTextFile = _
fsoFileSystem.CreateTextFile(strFullFilePath & strExportFile, True, False)
strFieldDelimiter = " "
Do Until rstTableToExportRecords.EOF
strTextFileRow = ""
For Each fld In rstTableToExportRecords.Fields
strTextFileRow = strTextFileRow & rstTableToExportRecords(fld.Name) & strFieldDelimiter
Next fld
If Len(strTextFileRow) = 0 Then
Else
If Right(strTextFileRow, 1) = strFieldDelimiter Then
strTextFileRow = Left(strTextFileRow, (Len(strTextFileRow) - 1))
Else
End If
End If
tsoTextFile.WriteLine (strTextFileRow)
rstTableToExportRecords.MoveNext
Loop
Thanks for your time