import multiple files to excel
Just a typo alert...
I bet Tom meant:
v = Array("1.txt", "2.txt", "3.txt")
instead of:
v = Array(1.txt, 2.txt, 3.txt)
Tom Ogilvy wrote:
No built in command for that. You can import text files into existing
sheets or you can open text files and they become their own workbook
I would do the second, then move the sheet to the subject workbook
Dim bk as Workbook, v as Varaint
Dim i as Long
v = Array(1.txt, 2.txt, 3.txt)
for i = lbound(v) to ubound(v)
set bk = workbooks.Open("C:\MyTextFiles\" & v(i))
With thisworkbook
bk.worksheets.Move After:=.worksheets(worksheet.count)
set bk = Nothing
End With
Next
Once the sheet is moved, the workbook that was created should disappear.
--
Regards,
Tom Ogilvy
wrote in message
oups.com...
Is there a macro to import multiple .txt files and open them in
separate sheets within the same workbook .
Thanks,
Cindy
--
Dave Peterson
|