View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Lynn Bales Lynn Bales is offline
external usenet poster
 
Posts: 12
Default importing multiple text files into individual worksheets in wo

Tom,

How could you use this to work with delimited data? I have multiple .chr
files where the string is delimited by " and the field by , that I'd like to
get into individual sheets in one workbook. I tried to mess with your code,
but can't figure it out.

Thanks!

"Tom Ogilvy" wrote:

Sub ImportFiles()
Dim sPath as String, sName as String
Dim bk as Workbook
sPath = "C:\MyTextFiles\"
sName = dir(sPath & "*.txt")
do while sname < ""
set bk = workbooks.Open(sPath & sname)
bk.worksheets(1).Move After:= _
thisworkbook.worksheets( _
thisworkbook.worksheets.count)
sname = Dir()
Loop
End sub

--
Regards,
Tom Ogilvy


" wrote:

Hi I've searched through group and haven't quite found an answer for my
use.
I have multiple individual text files, that contain simple text.
I want to import them into 1 workbook each as a seperate worksheet.Each
text file,single column, and each text line as a seperate row in sheet.

Thanks
Guy