View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
bw bw is offline
external usenet poster
 
Posts: 74
Default Incompatible Code

Thanks Debra, that's it!

I had just posted another note indicating that I had discovered this..

I appreciate your help.

Bernie

On Fri, 25 Jul 2003 23:28:30 -0400, Debra Dalgleish wrote:
Try changing the Origin to:

Origin:=xlWindows

bw wrote:
Thanks Myrna, but that was the first thing I tried.

That code produces the error message I indicated earlier. The code I am now using

is
exactly as you have indicated, and produces the Run-time error '1004'.

Do you have another suggestion?

Bernie


On Fri, 25 Jul 2003 21:39:14 -0500, Myrna Larson wrote:

Ah, you left out the critical information -- the Excel version numbers -- in your first

post!!

TrailingMinusNumbers is the problem. That was added in Excel 2002. If you don't

need

it, just

remove that argument so it looks like

Workbooks.OpenText Filename:=my2ndFileName, Origin:=437, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray

On Sat, 26 Jul 2003 01:59:38 GMT, bw wrote:


Sorry about that...I should have included the error with my first message.

I should let you know that the Excel versions on the two computers are as follows:
The Windows 2000 computer is Excel 2002 (10.2614.3311)
The Windws XP computer is Excel 2000 (9.0.3821 SR1)

And from this, I see there "may" be a backward compatiblity issue. If so, what code

do I

use in Excel 2000 to make it "upward" compatible with Excel 2002?

The error message I'm getting is:
Run-time error '1004':
Method 'OpenText' of object "workbooks' Failed

Thats it. I hope someone can help make this run...

Bernie



On Fri, 25 Jul 2003 20:14:48 -0400, "Bob Kilmer" wrote:

Code works for me in XP. If I substitute local values for the variables.
What error message are you getting?

The best I can find about TrailingMinusNumbers at MSDN is this description:

TrailingMinusNumbers Optional Variant. Numbers that begin with a minus
character.
Bob Kilmer

"bw" wrote in message
...


The following code works with Windows 2000, but not with Windows XP. Can

someone

explain why, and provide a workaround?

Also, what does "TrailingMinusNumbers" do?

Workbooks.OpenText Filename:=my2ndFileName, Origin:=437, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray, _
TrailingMinusNumbers:=True

Thanks,
Bernie










--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html