Horizontal Spacing Text File

ProgramRasta

Member
Local time
Today, 01:03
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.

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
 
I'm afraid I'm very confused;
A single space is exactly that 1 x " "

How can it be 'bigger' ?
 
Use a TAB character?
 
I'm afraid I'm very confused;
A single space is exactly that 1 x " "

How can it be 'bigger' ?
I clearly didn't explain the problem too well!

The output is the following:

Field1 Field2 Field3...

I want the output to be

Field1 Field2 Field3

As above more horizontal spacing but using a single space. Is there any way to increase the width of the space to say a tab?

It's probably a stupid question, I was unable to find anything online to point me in the right direction.

Thanks for your time.
 
You swap the space for a tab character?
 
As per @Gasman try using a tab character

strFieldDelimiter =Chr(9)
 
As above more horizontal spacing but using a single space.
?!
This is simply not possible. If your specification requires columns to be separated by a single space you can neither replace it by something else (TAB) nor can you make a single space wider than a single space.
 
Not sure I follow either but perhaps consider using a monospaced font like Courier New
 

Users who are viewing this thread

Back
Top Bottom