Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am new to programming in excel so please bear with me. I am trying to write some code to automate the external data import of multiple files. I have recorded the following macro to give me some idea of where to start but i need help on how to finish Here is the code I have With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\Users\otto\Desktop\Pool Volume Data\house1", Destination:= _ Range("A1")) .Name = "house1" <-- This is the name of the file that will change i.e (house1,house2,house3) .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 437 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = True .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = True .TextFileColumnDataTypes = Array(1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With End Sub I would like to have a macro that adds a new sheet to the workbook and then loops through each of my files (house1 to house 70). Any help that could be offered would be very much appreciated. Sincerely, Rambo |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this example
http://www.rondebruin.nl/txtcsv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Rambo" wrote in message ... Hi, I am new to programming in excel so please bear with me. I am trying to write some code to automate the external data import of multiple files. I have recorded the following macro to give me some idea of where to start but i need help on how to finish Here is the code I have With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\Users\otto\Desktop\Pool Volume Data\house1", Destination:= _ Range("A1")) .Name = "house1" <-- This is the name of the file that will change i.e (house1,house2,house3) .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 437 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = True .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = True .TextFileColumnDataTypes = Array(1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With End Sub I would like to have a macro that adds a new sheet to the workbook and then loops through each of my files (house1 to house 70). Any help that could be offered would be very much appreciated. Sincerely, Rambo |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 24, 10:27*am, "Ron de Bruin" wrote:
Try this examplehttp://www.rondebruin.nl/txtcsv.htm -- Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm "Rambo" wrote in ... Hi, I am new to programming in excel so please bear with me. *I am trying to write some code to automate the external data import of multiple files. *I have recorded the following macro to give me some idea of where to start but i need help on how to finish Here is the code I have With ActiveSheet.QueryTables.Add(Connection:= _ * * * *"TEXT;C:\Users\otto\Desktop\Pool Volume Data\house1", Destination:= _ * * * *Range("A1")) * * * *.Name = "house1" *<-- This is the name of the file that will change i.e (house1,house2,house3) * * * *.FieldNames = True * * * *.RowNumbers = False * * * *.FillAdjacentFormulas = False * * * *.PreserveFormatting = True * * * *.RefreshOnFileOpen = False * * * *.RefreshStyle = xlInsertDeleteCells * * * *.SavePassword = False * * * *.SaveData = True * * * *.AdjustColumnWidth = True * * * *.RefreshPeriod = 0 * * * *.TextFilePromptOnRefresh = False * * * *.TextFilePlatform = 437 * * * *.TextFileStartRow = 1 * * * *.TextFileParseType = xlDelimited * * * *.TextFileTextQualifier = xlTextQualifierDoubleQuote * * * *.TextFileConsecutiveDelimiter = True * * * *.TextFileTabDelimiter = True * * * *.TextFileSemicolonDelimiter = False * * * *.TextFileCommaDelimiter = False * * * *.TextFileSpaceDelimiter = True * * * *.TextFileColumnDataTypes = Array(1, 1, 1) * * * *.TextFileTrailingMinusNumbers = True * * * *.Refresh BackgroundQuery:=False * *End With End Sub I would like to have a macro that adds a new sheet to the workbook and then loops through each of my files (house1 to house 70). Any help that could be offered would be very much appreciated. Sincerely, Rambo- Hide quoted text - - Show quoted text - Much thanks for this...it works nicely Rambo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Importing data from multiple excel files | Excel Discussion (Misc queries) | |||
Importing External Data From Several Files | Excel Discussion (Misc queries) | |||
Importing pieces of data from multiple files | Excel Programming | |||
Need advice : consolidating data from multiple CSV files in Excel - External data handling | Excel Programming | |||
Importing Multiple Data Files | Excel Programming |