csvPadForFixedLengthFields

Description: This method will pad each field to a fixed length, with a specifically chosen character. For example, the file before applying this process looks like:

Data001,Data2,Data0003,Data4

Data1,Data000002,Data3,Data04

After applying this process having specified a 10 character field, padded right with a # character, it looks like:

Data001###,Data2#####,Data0003##,Data4#####

Data1#####,Data000002,Data3#####,Data04####

Parameters:

csvPadForFixedLengthFields(sInputFile As String, sOutputFile As String, lLength As Long, sCharToUse As String, bPadLeft As Boolean, sColumn As String) As Long

Parameter

Meaning

sPathOriginal

CSV file to modify

sPathTarget

Can be same as sPathOriginal in which case sPathOriginal will be overwritten. If a different name is specified, XLSConverterX will create a new file.

lLength

Length to make each field

sChar

Character to pad with, typically a space or "0"

bPadLeft

If TRUE will pad to the left, otherwise will pad to the right

sColumn

Which columns the padding should be applied to. May specify individual columns or ranges such as 1,3-5 or may specify all with an asterisk *

Return Values:

0: Success 

-2: "Unable to open or save to target file. Could be a sharing violation, or invalid file type: (") + co.sTargetFile + ")" 

-3: "Unable to open original file. Check file format. Could be a sharing violation: (") + co.sOriginalFile + ")" 

-201: "Shareware has expired" 

Example Code: