kdjonesmtb2
Technical User
The following code puts the entire text file that has "*" delimiters for each field/column into Column A in an Excel spreadsheet
How would I get the txt file to be broken into columns by the delimiter "*"?
const toRead = 1
row=1
'Dim i
set objFSO = CreateObject("scripting.filesystemobject")
set objFile = objFSO.OpenTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\MNSure 820 files\M377668100_820_A400000004_20131106123300_IND.txt", toRead)
dim filename()
i=0
Do until objFile.atEndofStream
Redim Preserve filename(i)
filename(i) = objfile.readline
i=i+i+1
loop
objFile.close 'closes this file
For Each strline in filename
myarray = split(strline, "", -1, 1)
for each sline in myarray
datatable("A",dtglobalsheet)=sline
row=row+1
next
next
datatable.exportsheet "\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\test3.xls",1
Sample txt file data:
Goal is to load text file into DataTable and compare column lengths for individual columns against expected lengths and data types
ISA*00* *00* *ZZ*M377668100 *ZZ*A470618100
How would I get the txt file to be broken into columns by the delimiter "*"?
const toRead = 1
row=1
'Dim i
set objFSO = CreateObject("scripting.filesystemobject")
set objFile = objFSO.OpenTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\MNSure 820 files\M377668100_820_A400000004_20131106123300_IND.txt", toRead)
dim filename()
i=0
Do until objFile.atEndofStream
Redim Preserve filename(i)
filename(i) = objfile.readline
i=i+i+1
loop
objFile.close 'closes this file
For Each strline in filename
myarray = split(strline, "", -1, 1)
for each sline in myarray
datatable("A",dtglobalsheet)=sline
row=row+1
next
next
datatable.exportsheet "\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\test3.xls",1
Sample txt file data:
Goal is to load text file into DataTable and compare column lengths for individual columns against expected lengths and data types
ISA*00* *00* *ZZ*M377668100 *ZZ*A470618100