Hi,
This is my first post, hope I'm respecting all the forum rules (I am trying to be concise but clear).
I would like to use a vba procedure/procedures to achieve the following:
I have a folder with many Word2003 forms in and I want to save just the data from each form and then import the data into an Excel spreadsheet.
Currently I am opening each .doc file in turn, saving just the data to a new plain text (comma separated file) in a different folder and am unable code searching that folder for all the text files and importing them into the spreadsheet.
I have a two part question to my current approach:
1) I am 99% there with the first part (opening and converting the forms) with the following code having followed advice from another thread but I need Word open and not showing an open document. Is it possible to add code to take care of opening Word in the background and close it again after so the process is fully automated?:
Second part:
2) Currently after I have run the code above I have a new folder full of plain text files each containing only a single line. How can I import each file into a new row in excel?
I have recorded the import process with the macro recorder but have to state the file explicitly rather than something like
Extra thoughts (these are not intended to be anticipated solutions just things I have struggled with as ways around my problem):
- Would this process be better achieved virtually without actually creating a folder full of new files? How would I do that?
- Would it be better, since it is a text file that I want to write the data to, to write data from each form to a new line of the same text file? Then I would have only 1 file to import? I don't know how to do that either though.
I know this is long winded but I am new to VBA and have spent hours playing with code (unsuccessfully) to try and figure it out and wanted to be as clear as possible.
If I am going about this all wrong please enlighten me with an approach to deal with my initial statement of what I trying to achieve.
All help gratefully received!
Matthew
Bookmarks