Opening multiple files from folder
Posted by Cage on May 21, 2001 11:03 PM
Hi
I have an Excel Workbook that opens *.prn file and creates chart from data in it. Now I need to do macro that opens all *.prn files from folder and convert data from them to sheets. This is code for opening one file:
Sub OpenFile()
On Error Resume Next
Workbooks.OpenText FileName:="c:\excel\MyFile.prn",
Origin:=xlWindows,StartRow:=1,DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote,
ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=False, Comma:=True, Space:=False,
Other:=False, FieldInfo:=Array(Array(1, 1),
Array(2, 1), Array(3, 1))
Set MyObject = Sheets(1)
MyObject.Name = "MyOpenedFile"
End Sub
I just don't know how to open multiple files and fetch data from them to their own Sheet in workbook. Can someone help me?
- Cage -