a weird one- workbooks.opentext error

flix

Board Regular
Joined
Jun 25, 2003
Messages
158
this is a weird one, the following bit of code is part of a longer sub, but this is the important part:
Code:
'   Open & import data and rename sheet
If f <> False Then

    Workbooks.OpenText Filename:=f, Origin:=437, _
        StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
        ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=True _
        , Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True

now i have been working on this spreadseet on my computer for quite some time, and its all working fine, yet when i run this on my collagues computer i get the following error:
Named arguement not found
this error then highlights the part:
Code:
TrailingMinusNumbers:=True

what i dont understand is, how can it work fine on mine, but not work on his??
excel versions should be the same, as should be windoze....

any ideas?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I think that argument of the OpenText method, is new in Excel 2002.

Delete TrailingMinusNumbers:=True and the comma before it. I can't imagine it makes any difference to the workings of the macro.
 
Upvote 0
ill try deleting it see what happens...

it wouldnt have anything to do with declaring it, as i tried:
Code:
Dim TrailingMinusNumber As Variant
but i think that wouldnt be the reason after the error code i got...

do i have any other options if the version of excel is too old?? is there a similiar command in excel 2000??
 
Upvote 0
The variable declaration is irrelevant. The error occurs because the argument doesn't exist.

I expect you got your code by recording a macro. There isn't an equivalent in earlier versions, but, as I said, I'm pretty sure deleting that part won't make any difference to the workings of your code.
 
Upvote 0
well i deleted it on mine, and it works fine....
i recorded that part of the macro, as i wanted the imported ascii file to be comma delimited, and that was the easiest way for me to do it...hopefully this will make it work on the other one aswell....

ta

edit: it was the version of excel. deleting the part did help, but as soon as it got back to that command it stopped again. other computer getting upgraded now, as that command is a really nice way of importing data, and now that im using it my collague wants to use it too...
 
Upvote 0

Forum statistics

Threads
1,216,419
Messages
6,130,515
Members
449,585
Latest member
kennysmith1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top