View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
IanKR IanKR is offline
external usenet poster
 
Posts: 97
Default Open tab text file method

i use "open file for input" method to import text from text file to
excel.
however it import the text as a whole line, without any tab
separation.
is there any method i can reserve the "TAB" from text file to Excel.


One solution would be to open a blank workbook, turn on the macro
recorder (have the macro recorded in the current blank workbook) and go
through manually what you do when you import the text file, remmebering to
set Tab as the delimiter. Then look at the code generated and edit the macro
if need be, if it needs generalising.

The code that opens the text file will look something like this:

Workbooks.OpenText Filename:="<Your txt filename", dataType:=xlDelimited,
tab:=True ...