Your code worked fine for me in xl2003
Sub ABC()
lcFilename2 = "C:\" & Dir("c:\*.txt")
Workbooks.OpenText Filename:=lcFilename2, _
Origin:=xlWindows, _
StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=False, Semicolon:=True, _
Comma:=False, Space:=False, Other:=False, _
FieldInfo:=Array(Array(1, 2), Array(2, 5), _
Array(3, 2), Array(4, 2), Array(5, 2), _
Array(6, 2), Array(7, 2), Array(8, 1), _
Array(9, 1), Array(10, 1), Array(11, 1), _
Array(12, 1), Array(13, 1), Array(14, 5), _
Array(15, 5), Array(16, 2), Array(17, 2), _
Array(18, 2), Array(19, 1))
End Sub
I don't have xl2002 handy, but I don't see why there would be a problem.
--
Regards,
Tom Ogilvy
<richmarin@earthlink.net> wrote in message
news:1117201697.605436.159900@o13g2000cwo.googlegroups.com...
>
> I got a "method OpenText of object Workbooks failed" runtime error.
>
> I saw similar posts to mine. But, I did not see a solution. Strange.
> The command works in Excel 97. If I use the user interface and bring in
> a text file in manually it works. But, Excel 2002 can not handle
> OpenText.
>
> I don't know if the problem is XP or Excel 2002. And I need a solution
> quick cause I am under a tight deadline.
>
Bookmarks