Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone help me create code to accomplish the following:
I have a folder that has a bunch of text files in it. I would like to programatically open each file in a folder that contains the text '_MAST' in it, copy the contents, and then paste it into an excel worksheet. I would like it to keep looping through all of the text files in the folder until all of the contents are pasted into one excel worksheet. Any help would be greatly appreciated. -- Regards, timmulla |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi timmulla
Try the example on this page http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Can anyone help me create code to accomplish the following: I have a folder that has a bunch of text files in it. I would like to programatically open each file in a folder that contains the text '_MAST' in it, copy the contents, and then paste it into an excel worksheet. I would like it to keep looping through all of the text files in the folder until all of the contents are pasted into one excel worksheet. Any help would be greatly appreciated. -- Regards, timmulla |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Ron,
The code works great for combining the text files. Is there any way to move the files that don't contain the text '_MAST' out of the folder before I run the Merge-CSV_Files macro. I'm only trying to combine the files that have that text. I'm thinking that moving the other files to another folder before running the macro will solve the problem. Any information would be greatly appreciated. -- Regards, timmulla "Ron de Bruin" wrote: Hi timmulla Try the example on this page http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Can anyone help me create code to accomplish the following: I have a folder that has a bunch of text files in it. I would like to programatically open each file in a folder that contains the text '_MAST' in it, copy the contents, and then paste it into an excel worksheet. I would like it to keep looping through all of the text files in the folder until all of the contents are pasted into one excel worksheet. Any help would be greatly appreciated. -- Regards, timmulla |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Change this part 'Create the bat file Open BatFileName For Output As #1 Print #1, "Copy " & Chr(34) & foldername & "*_MAST*.txt" _ & Chr(34) & " " & TXTFileName Close #1 -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Hey Ron, The code works great for combining the text files. Is there any way to move the files that don't contain the text '_MAST' out of the folder before I run the Merge-CSV_Files macro. I'm only trying to combine the files that have that text. I'm thinking that moving the other files to another folder before running the macro will solve the problem. Any information would be greatly appreciated. -- Regards, timmulla "Ron de Bruin" wrote: Hi timmulla Try the example on this page http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Can anyone help me create code to accomplish the following: I have a folder that has a bunch of text files in it. I would like to programatically open each file in a folder that contains the text '_MAST' in it, copy the contents, and then paste it into an excel worksheet. I would like it to keep looping through all of the text files in the folder until all of the contents are pasted into one excel worksheet. Any help would be greatly appreciated. -- Regards, timmulla |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Ron. The code works great. I just realized that it's importing the
header rows from each of my txt files. Is there a way to only import the header row from the first file? Or is it easier to loop through the excel outoput file and delete the duplicate header rows? Any information would be greatly appreciated. -- Regards, timmulla "Ron de Bruin" wrote: Hi Change this part 'Create the bat file Open BatFileName For Output As #1 Print #1, "Copy " & Chr(34) & foldername & "*_MAST*.txt" _ & Chr(34) & " " & TXTFileName Close #1 -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Hey Ron, The code works great for combining the text files. Is there any way to move the files that don't contain the text '_MAST' out of the folder before I run the Merge-CSV_Files macro. I'm only trying to combine the files that have that text. I'm thinking that moving the other files to another folder before running the macro will solve the problem. Any information would be greatly appreciated. -- Regards, timmulla "Ron de Bruin" wrote: Hi timmulla Try the example on this page http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Can anyone help me create code to accomplish the following: I have a folder that has a bunch of text files in it. I would like to programatically open each file in a folder that contains the text '_MAST' in it, copy the contents, and then paste it into an excel worksheet. I would like it to keep looping through all of the text files in the folder until all of the contents are pasted into one excel worksheet. Any help would be greatly appreciated. -- Regards, timmulla |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Change the start row
StartRow _ :=1 And copy the header row manual in the sheet one time when the code is ready -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Thanks, Ron. The code works great. I just realized that it's importing the header rows from each of my txt files. Is there a way to only import the header row from the first file? Or is it easier to loop through the excel outoput file and delete the duplicate header rows? Any information would be greatly appreciated. -- Regards, timmulla "Ron de Bruin" wrote: Hi Change this part 'Create the bat file Open BatFileName For Output As #1 Print #1, "Copy " & Chr(34) & foldername & "*_MAST*.txt" _ & Chr(34) & " " & TXTFileName Close #1 -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Hey Ron, The code works great for combining the text files. Is there any way to move the files that don't contain the text '_MAST' out of the folder before I run the Merge-CSV_Files macro. I'm only trying to combine the files that have that text. I'm thinking that moving the other files to another folder before running the macro will solve the problem. Any information would be greatly appreciated. -- Regards, timmulla "Ron de Bruin" wrote: Hi timmulla Try the example on this page http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "timmulla" wrote in message ... Can anyone help me create code to accomplish the following: I have a folder that has a bunch of text files in it. I would like to programatically open each file in a folder that contains the text '_MAST' in it, copy the contents, and then paste it into an excel worksheet. I would like it to keep looping through all of the text files in the folder until all of the contents are pasted into one excel worksheet. Any help would be greatly appreciated. -- Regards, timmulla |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Looping through multiple sheets and pasting data in first blank ro | Excel Programming | |||
Print Excel worksheet several times, looping value of 1 cell | Excel Programming | |||
CAN I CLUB SIMILAR EXCEL FILES WITHOUT COPYING AND PASTING | Excel Discussion (Misc queries) | |||
Looping through excel files to add to a new workbook | Excel Programming | |||
Looping thru files | Excel Programming |