Hi All,
I'm having a problem with using data from a text file. I currently have my program set up to open a text file, copy the lines of text, and paste it into Excel.
My problem is this:
If my lines of text looks like this:
09/08/2002 1 0000.00 7662.24 0015.99 0501.46 0000.00 0000 0008.17
INVENTORY 1057.70 0115.28 0000.00 0328.74 0000.45 0000.00 0019.89 0000.00 0000.00 0000.00 -0022.79 0000.00 0000.00 0000.00
With the 3rd set of numbers from the end (0000.00), whether or not there is a value in there, it tries to split the number (so it will be 0) and then in the next cell, it will place (0 0000.00) so it isn't a proper number. Another example is that if the 3rd number set from the end was 5.4, it will paste it in my spreadsheet as 5, with the next cell 4 0000.00)
Originally when I created this code, I just recorded a macro of me cutting and pasting the data. I've gone back in and recreated the macro, and it will work for that file, but a few days letter the numbers no longer seem to allign.
The code for this section is:
Workbooks.OpenText Filename:=txtFile, _
Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(11, 1), Array(15, 1), Array(22, 1), Array(31, 1), Array(40, 1), _
Array(49, 1), Array(58, 1), Array(69, 1), Array(77, 1), Array(87, 1), Array(95, 1), Array( _
103, 1), Array(113, 1), Array(120, 1), Array(130, 1))
I've tried to play around with the numbers a bit, but I don't really understand them
Can anyone help me out with this??
Thanks in advance.
(Sorry it was so long!)
amber
I'm having a problem with using data from a text file. I currently have my program set up to open a text file, copy the lines of text, and paste it into Excel.
My problem is this:
If my lines of text looks like this:
09/08/2002 1 0000.00 7662.24 0015.99 0501.46 0000.00 0000 0008.17
INVENTORY 1057.70 0115.28 0000.00 0328.74 0000.45 0000.00 0019.89 0000.00 0000.00 0000.00 -0022.79 0000.00 0000.00 0000.00
With the 3rd set of numbers from the end (0000.00), whether or not there is a value in there, it tries to split the number (so it will be 0) and then in the next cell, it will place (0 0000.00) so it isn't a proper number. Another example is that if the 3rd number set from the end was 5.4, it will paste it in my spreadsheet as 5, with the next cell 4 0000.00)
Originally when I created this code, I just recorded a macro of me cutting and pasting the data. I've gone back in and recreated the macro, and it will work for that file, but a few days letter the numbers no longer seem to allign.
The code for this section is:
Workbooks.OpenText Filename:=txtFile, _
Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(11, 1), Array(15, 1), Array(22, 1), Array(31, 1), Array(40, 1), _
Array(49, 1), Array(58, 1), Array(69, 1), Array(77, 1), Array(87, 1), Array(95, 1), Array( _
103, 1), Array(113, 1), Array(120, 1), Array(130, 1))
I've tried to play around with the numbers a bit, but I don't really understand them
Can anyone help me out with this??
Thanks in advance.
(Sorry it was so long!)
amber