View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Macro crashing on different computer

I don't think I was clear enough or was hoping you'd read
my first post carefully. Your first response seemed to
idnicate that, as long as I shortened my x12002 command
to end after the "field info" data, it should work.

Here is what I have:

Workbooks.OpenText Filename:="fllcgsumprf.*",
Origin:=437, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array( _
Array(0, 1), Array(7, 3), Array(17, 1), Array(32,
1), Array(40, 1), Array(48, 1))

The error messgae is that Method 'OpenText' of object
workbooks failed. Actually, the filename really should
be a variable but to eliminate sources of problems, I
have temporarily hardcoded the filename. It is a text
type CSV file. Perhaps, X12000 doesn't recognize the
command? What do you think?

Also, I'm not sure what the post processing is supposed
to do. Can soemone tell me?

Thx
-----Original Message-----

the ARRAY is part of the fieldinfo argument,that has

nothing todo with
your problem..


you recorded it in xl2002..

it then records/uses some arguments which may OR MAY NOT

be available in
prior versions.

Would you be trying it in xl97 your whole routine would

fail,
as xl97 doesn't have the importtext method...

You're trying it in xl2000 which doesn't have the

arguments for trailing
minus and locale settings...


the problem is the use of TrailingMinusNumbers or Local

argument, which
excel 2000 cannot compile...

just remove the trailing minus argument and you should

be fine..

EXCEPT you're not fine ...
as your data apparently DOES include trailing minuses..


excel2000 cannot handle those INSIDE the textimport

function,
so to make a compatible routine you have to do some post

processing..

remove the trailing minus argument..
the AFTER you import the data you need to sweep the

range..

dim rng as range
For each rng in [a1].currentregion.cells
if rng.value like "*-" then
rng.value = Left(rng.value,len(rng.value)-1) *-1
endif
next


Hth :)



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"add to prior question"

wrote:

Also, why did it record something very different for
origin (see original post below)?

G

-----Original Message-----
So, it looks identical up through field info. But I

seem
to be having a problem, even if I end it right at

Array(48, 1))

Shouldn't it work that way with EXCEL 2000?

Thx,
G

.