Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing a Text File in Excel

Status
Not open for further replies.

Wilsond3010

Programmer
Jan 23, 2001
4
GB
I'm trying to open a text with the xlapp command from vb5.

But I can't get the text file to open in comma delimitated format.

Anyone help me.
 
Just record a macro and open the file manually. This will give you the necessary code.
Here is the code that was generated on one of my files:
Code:
    ChDir "H:\RefData"
    Workbooks.OpenText FileName:="H:\RefData\FLAN_150.REF", Origin:=xlWindows, _
        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), _
        Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), _
        Array(10, 1), Array(11, 1), Array(12, 1))

If the file(s) will have a variable number of columns and items, you may want to write a program to read the data and write it to Excel rather than trying to import it. If you would like some sample code to do this, just let me know.

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top