View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
gocush[_29_] gocush[_29_] is offline
external usenet poster
 
Posts: 252
Default load several ASCII files in different worksheets

The vba function you want to start with is
GetOpenFilename

See the Help for this.

"bandy2000" wrote:

what I wanted to do is to select a folder and automatically all files with
the ".res" suffix will be processed. The folder should be selected in a
regular file dialog.

this is the code for the opening of the file that I recorded earlier:
Sub Macro_open_file()
'
' Macro_open_file Macro
' Macro recorded 3/13/2005 '

'
Workbooks.OpenText Filename:= _
"C:\Measurement Results\FolderName\FileName.res" _
, Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
1), _
Array(2, 1)), TrailingMinusNumbers:=True

I'm not sure how I will have to do the copy and paste operation and how I
should record it.

"Myrna Larson" wrote:

Yes, of course that would be the case. You must post the code you have and
tell us how you want to select the directory and the files to be processed,
i.e. what the file extensions are, etc.


On Mon, 14 Mar 2005 20:37:04 -0800, bandy2000
wrote:

I recorded it already one time but it is all set to exactly the selected
folder and the file name nothing is random. So only for this file it can be
reused.


"Myrna Larson" wrote:

You'll probably need to open each one, then move or copy the sheet into the
master workbook.

Record the steps as you do this manually, then somebody can help with
modifications to make it operate on all files in a directory (.TXT? .CSV?)


On Mon, 14 Mar 2005 15:57:01 -0800, bandy2000
wrote:

HI
How can I load all files contained in one folder into a new worksheet for
each file?
How can I select the folder before as it is not static?
Thanks