Microsoft Word can be used to create a digital form complete with a variety of controls. This form can be distributed, filled out by a respondent, and returned to the sender. This article deals specifically with a Form created using the Legacy Form controls.
In this post:
Required knowledge:
- Mastering Controls in Word
1. Saving form data
The completed form can be opened and viewed, but how does one collate the data from multiple copies of the form?
One would imagine being able to create some kind of data connection to Excel or Access, or even the simple option to select a common text file to receive the data in some kind of delimited text file.
In reality, the method is a manual, clunky and time-consuming affair. Open a completed form and click through the following sequence:
File » Options » Advanced » Preserve fidelity when saving this document » Save form data as delimited text file
The above process does exactly what it says it will do: it creates a simple .txt file with the same name as the Word document with one line of comma-delimited data.
It would be far more practical if there was an option for selecting an output file that you could then specify as the target, allowing you to append data from multiple completed copies of the Word form to one text file that could then be imported into Excel or Access.
You could quite easily open all the resulting text files in a text editor such as Notepad++ and copy-paste all the lines of data into a common text file.
2. PowerShell solution
The following quick lines in PowerShell are the beginning of a very basic scripted solution:
$MySrcPath = "C:\Users\YourProfile\Desktop\WordFormFolder" $MyDest = "C:\Users\YourProfile\Desktop\WordFormFolder\combined.csv" gci -file $MySrcPath -Recurse -Include "*.txt" | gc >> $MyDest
PowerShell solution adapted from: https://stackoverflow.com/questions/43287039/combine-text-from-multiple-files-into-a-single-file