Use this command:
Workbooks.OpenText <parameters>
Like i said before, record the file being opened into a macro to get the correct parameter settings. This will open the file in excel with tab delimiters working correctly.
You wont have to do any coding at all using this solution. Never underestimate the power of being able to record a macro. Much of the time you'll find out all sorts of coding tricks by using this functionality.
Here's an example of the opentext command that was generated when I recorded the opening of a tab delimited file:
'|||||||||||||||||||||||||||||||||||||||||||||||||
Sub OpenTabDelimitedFile()
'
' OpenTabDelimitedFile Macro
'
'
ChDir "C:\TCM\Database\Metrec\documents\James Docs 081200"
Workbooks.OpenText FileName:= _
"June00balsht1.txt", Origin _
:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1)
End Sub
'||||||||||||||||||||||||||||||||||||||||||||||||||||||
The only thing that would need to be changed would be the last parameter FileInfo which is an array of the sizes and formats of each field in the file. To get this parameter correct you should definately record the file open process and let excel generate it. The above statement is complicated and hard to follow, but it will save reams and reams of code that you'd need to do it any other way.
Hope this helps,
K.