Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Import of multiple .CSV files into Excel

Hi @ll,

I need to build a macro to import data from all .csv files located in
specific directory into an Excel file (on the same sheet)...

I have manage to build a single extract (with 1 file) but I need to b
able to loop threw all files, extract the data, copy and paste and th
bottom of the sheet...

Here is the code of the macro for the single extract :

Sub Macro1()

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Test\test.csv", _
Destination:=Range("A1"))
.Name = "test"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 4
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1
1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With

End Sub


Please advise,
Thx
Ayat

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import Multiple XML Files into Excel Mungkol Excel Discussion (Misc queries) 3 January 22nd 09 01:37 PM
import multiple csv files into excel 2007 Annie - torston Excel Discussion (Misc queries) 1 January 15th 09 06:24 AM
Excel VBA - Import Data for manipulation from multiple text files ZX210 Excel Programming 2 January 13th 04 02:38 PM
Import multiple text files into excel Wally Steadman[_2_] Excel Programming 1 November 15th 03 04:14 PM
Import multiple files macro can't find files Steven Rosenberg Excel Programming 1 August 7th 03 01:47 AM


All times are GMT +1. The time now is 11:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"