I'm fairly conversant with Word and Excel, so I feel fairly sure this CAN be done, but I'm having trouble figuring out exactly how. If the answer involves using Access or MS Query, that's OK too, but step-by-step instructions would be appreciated in that case.
I have a number of text-only files, sent to an e-mail address by a form on a web site. They all look like this:
LastName: Smith
FirstName: John
Address1: 123 Main Street
Address2:
City: Anytown
State: NY
Zip: 12345
e-mail: name@domain.com
And many other fields. Please note that blanks do occur, and would have to be taken into account in any solution.
I need to take the values entered by the user in the web form, and get them to appear within mail merge fields in Word. I have the form all set up in Word, and the client loves the way it looks. The only thing we need now is to extract the values, ignoring the field labels generated by the CGI script, and dump them into the proper fields in the Word file.
I have the freedom to rename the fields in the CGI script to anything I want. I can even make all the fields exactly the same length (field0001, field0002, etc.) if that would help. I need the parsing routine to ignore everything on each line up to and including the colon and the space following it, and then get everything after that up to the EOL. Then repeat that for every form field.
I can easily search and replace in the Word file to make all the colon-spaces into tabs, convert the resulting tab-delimited text into a table, and then eliminate the first column completely, but then I'm just left with a column of values, and I'm not sure what to do next to make that column into a data source for Word to pull from.
I feel like I'm close to the solution, just a couple of pieces of the puzzle missing. Any help you can provide will be gratefully accepted.
Thanks!