Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Repeat importing text

Hi, all,

Posts following Clayton's question regarding how to import text in VBA are
helpful but the code can only import one text file each time. I have a
folder which contains a number of log files which have uniform format. The
number of files vary from time to time. I want to import all of them in XL.
Can anybody give me a sample code to determine the number of file that meets
its importing critera in a folder and load them into one sheet of XL? Or
give me hint where to go?

Regards,

Huyeote


  #2   Report Post  
Posted to microsoft.public.excel.programming
acw acw is offline
external usenet poster
 
Posts: 19
Default Repeat importing text

Huyeote

The code below should give you a start on how to identify
the files which match your criteria.

Sub bbb()
ChDir "c:\temp"

With Application.FileSearch
.FileName = "*.txt"
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
End If
End With
End Sub

The line MsgBox .foundfiles(i) can be modified to input
the code you have about opening a text file. If the files
area all standard size, then you can select the entire
file, copy and then paste it to the output file. You can
then find the next blank cell in the output file
(something like range("a65536").end(xlup).offset
(1,0).select will take you there). You can then close the
opened text file, move to the next one and repeat.

HTH

Tony

-----Original Message-----
Hi, all,

Posts following Clayton's question regarding how to

import text in VBA are
helpful but the code can only import one text file each

time. I have a
folder which contains a number of log files which have

uniform format. The
number of files vary from time to time. I want to import

all of them in XL.
Can anybody give me a sample code to determine the number

of file that meets
its importing critera in a folder and load them into one

sheet of XL? Or
give me hint where to go?

Regards,

Huyeote


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing text--cell text limit? Scout Excel Discussion (Misc queries) 1 July 2nd 08 08:38 PM
Importing CSV file (saved as Text) into XL as Text -- over 60 colu sbp Excel Discussion (Misc queries) 1 October 14th 06 11:50 PM
Repeat Text PA New Users to Excel 4 August 30th 06 05:32 PM
how to repeat text on sheets in excel Kmart57 Excel Worksheet Functions 2 June 23rd 06 02:32 PM
Repeat text kmgrissen Excel Discussion (Misc queries) 1 May 23rd 06 04:57 PM


All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"