The amount of colums is always the same. The amount of rows can differ..
I got this peace of script below but it gives an error: Compile Error - User-defined type not defined at:
Function GetFiles(strFolderSpec As String) As Variant
Code:
Function GetFiles(strFolderSpec As String) As Variant
Dim fso As Scripting.FileSystemObject
Dim fld As Scripting.Folder
Dim fil As Scripting.File
Dim temp() As String
ReDim temp(0)
Set fso = New Scripting.FileSystemObject
Set fld = fso.GetFolder(strFolderSpec)
For Each fil In fld.Files
temp(UBound(temp)) = fil.Name
ReDim Preserve temp(UBound(temp) + 1)
Next fil
ReDim Preserve temp(UBound(temp) - 1)
GetFiles = temp()
End Function
Sub Main
Dim strFolder As String
Dim strFiles As Variant
Dim strFile As Variant
strFolder = "Z:\vba\temp\"
strFiles = GetFiles(strFolder)
For Each strFile In strFiles
Workbooks.OpenText Filename:=strFolder & strFile, Tab:=True
Next strFile
End Sub
I had the same ideas you did. I've tried if readfile() and writefile() can do the job but couldn't finished it before the end of the day...
_________________________
Co