That code is great. However, how can it be modified to import each selected txt file into a new row. I ran this macro and selected file. It worked great. Then i ran it again to grab another file and it just added it the data starting at the last column. Im new to macro writing and am trying to put the results from a Word Form survey I made in a spreadsheet. There are 60+ questions in the survey and I have a bunch of surveys to compile. I'd like to be able to select the individual txt files and have the imported dataput into different rows. Any help would be greatly appreciated.
Post a zip file somewhere that includes two of your text files and an Excel sheet with the data from those files showing the way you need. Then post a link here to where those files are posted and I'll take a look. It's really a whole different thing to do what you've described.
I was searching the forum to import text files and came across this old string that does what I want to do, sort of. The post by Williamsmacros seems to bring up something I want to do, import after the last import.
Here is what I’m doing. I have various tools out in my organization that help people do their job. To show return on (my) investment, I track the usage by writing an entry into a text file when they are used.
I then bring these text (tracking) files into another spreadsheet to number crunch them into reports for my boss to show the effect of my work for our folks. It’s working well, except now they text files are getting quite big and it takes a few minutes to get everything in.
I realized I’m re-importing all the text each time. If I could import the text file, and erase its contents and next time I import the text file, it just adds to the end of the list, I think this would speed things up. But of course each text file imports at a specific cell location.
I see in the code above (jbeaucaire, Apr 29th 2010 01:28 AM) there is a Destination:=Range(“$A$1”) that, I assume, sets the location. If I reset that to the next available row after the data I already imported, would that bring in the text that’s in the file after I erased it after the last import? – basically picking up where I left off?
If this is true, would I just code to do the import and delete the connections from the workbook connections area?
This did the trick and should speed up ingesting the text log files. My logging routine will (re) create the log file when used. So, when I import like you showed, I delete the log file so I don't get duplicate entries.