Nick
Nick

Reputation:

Import a fixed width text into Excel 2003 using VB

I have a fixed width text file and I want to automatically import certain spaces in each line into specific cells of an Excel 2003 sheet. Can you help me?

I will re-phrase my question because the previous one wasn't very clear. I need to read specific characters (i.e. 12-17, 23-29) and place them inside a excel sheet. Is this possible?

Upvotes: 0

Views: 1324

Answers (2)

dub
dub

Reputation: 1396

Yes it's possible. Check the "Fixed length" option in the import wizard and tell Excel how many characters there is for each field.

Upvotes: 1

cdonner
cdonner

Reputation: 37668

Excel will parse out any whitespaces and leading zeros when reading text. If you can, format your text file as CSV with delimited values, and format your values as formulas, like this:

=" Value 1",="0000",="     more spaces     ",="    "

This will preserve the values.

Upvotes: 0

Related Questions