Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I dont have much expertise in VBA but trying to learn. I am trying to import multiple csv files into excel. I have a macro from this forum to import the files one by one. But I want to be able to select and open the multiple files at once. Also with the macro that i have, the names of shees are coming like Sheet1, Sheet2 etc. I want to retain the names of the files for the sheets if possible. Many thanx for your efforts. Appending the macro I am using. U can suggest completely different approach If you think that open dialog box is not best. Using Excel 2003. Not much expertise in VBA. Thank You, Santosh Sub ImportTextUsingXlDialogOpen() '\ use this approach to prompt user for text wizard values Application.ScreenUpdating = False Application.DisplayAlerts = False '\ display open file dialog and copy to new (temporary workbook) 'On error resume next - traps for user clicking cancel in the import dialog 'Error number is 1004 - is so exit the procedure On Error Resume Next If Application.Dialogs(xlDialogOpen).Show("*.csv") Then If Err.Number = 1004 Then Exit Sub End If ActiveSheet.UsedRange.Select '\ select imported text in temporary workbook Selection.Copy '\ copy to clipboard ActiveWorkbook.Close '\ close temporary workbook Worksheets.Add Range("A1") = "Dialogs(xlDialogOpen) Method" Range("A2").Select ActiveSheet.Paste '\ paste text into your workbook End If Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto saving sheets from a workbook as separate files. | Excel Worksheet Functions | |||
Automated multiple text files into multiple sheets in one workbook | Excel Discussion (Misc queries) | |||
workbook sheets into separate files | Excel Worksheet Functions | |||
How do I save sheets in a workbook to separate files? | Excel Worksheet Functions | |||
Import several txt files into separate sheets within 1 workbook | Excel Programming |