opening text file in excel problem
What's the value of the variable Source?
If the name of that input file is *.csv, then excel will ignore your code for
each field.
If you find one of those offending cells (imported as text), what happens if you
use:
=len(x9)
(change the cell's address)
do you really get 10? dd/mm/yyyy
jz193 wrote:
I can;t see in my code where my specification of the format is actually- do I
need to add somethng to this (this is just a recorded macro) to do this?
Workbooks.OpenText FileName:= source, Origin _
:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=True, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1),
Array(7, 1), Array(8, 1), _
Array(9, 4), Array(10, 4), Array(11, 1), Array(12, 1), Array(13, 1),
Array(14, 1), Array(15 _
, 1), Array(16, 1), Array(17, 1), Array(18, 1))
"Dave Peterson" wrote:
Are you sure you choose the correct format for that field? mdy, dmy, ...
I've never seen excel fail to convert something that looked like that kind of
date to a date (during the text import).
jz193 wrote:
hi- thanks for the tip. I have already done this- the only way it works once
the macros is finished is to manually go into the cell and press F2 and
return. Any other suggestions appreciated.
"Pete" wrote:
Do it manually and record a macro while you do it. Set the column
formats for Date DMY as appropriate. Then you will be able to merge
bits of the recorded macro into the macro you have already developed.
Hope this helps.
Pete
--
Dave Peterson
--
Dave Peterson
|