How to Transfer Word Survey Results to Specific Excel Cells using VBA
Question details
The user wants to programmatically extract data from protected Word drop-down form responses and populate specific cells in an Excel workbook.

- Product
- Microsoft Excel, Microsoft Word
- Device & OS
- not provided
- Scenario
- Automating the consolidation of survey results by extracting responses collected in Word form fields and mapping them to predefined cells in an Excel tracker.
- Observed behavior
- The goal is to use a VBA script to open the Word document, identify specific form fields or inline controls, read their selected values, and write those values accurately into designated Excel cells.
Ensure that your Word document contains consistently named form fields (bookmarks) and that you have enabled the 'Microsoft Word Object Library' reference in the Excel VBA Editor.
Use an Excel VBA Macro to Extract Word Form Fields
Write a VBA script in Excel that opens the target Word document, loops through its form fields, and maps the extracted results to your chosen Excel cells.
By utilizing the Microsoft Word Object Library in Excel VBA, you can control the Word application in the background. This allows your script to locate specific form fields, read their current values (even if the document is protected for form filling), and insert them directly into designated spreadsheet cells.
Open your Excel workbook and press ALT + F11 to launch the VBA Editor. Navigate to the top menu, click 'Tools' > 'References', scroll down to find 'Microsoft Word XX.X Object Library', check the box next to it, and click 'OK'.
In the VBA Editor, right-click on your workbook name in the Project Explorer pane on the left, select 'Insert', and then click 'Module'. This will create a blank space for your macro code.
Create a sub-routine that defines a Word Application object. Use `Documents.Open` with the file path of your survey to open the Word file. Then, access the form fields by their bookmark names. For example, use `ActiveSheet.Range("B2").Value = wordDoc.FormFields("Dropdown1").Result` to pull the data.
At the end of your script, ensure you include code to close the Word document without saving changes (e.g., `wordDoc.Close False`) and quit the Word application instance to prevent memory leaks.
Save your Excel file as a Macro-Enabled Workbook (.xlsm). Press ALT + F8 to open the Macro dialog box, select your newly created script, and click 'Run' to transfer the survey data.

Easily Transfer Word Form Data to WPS Spreadsheet using Macros
WPS Office offers robust VBA and macro support, allowing you to effortlessly automate the extraction of survey responses from WPS Writer documents directly into WPS Spreadsheet cells without complex configurations.
- 1. Open WPS Spreadsheet: Launch WPS Spreadsheet and open the macro-enabled workbook where you want to collect the survey data.
- 2. Access the Developer Tools: Navigate to the 'Developer' tab on the top ribbon and click on 'Visual Basic' to open the VBA Editor.
- 3. Input Your Macro Code: Insert a module and write your VBA script to reference WPS Writer and map the document's form fields to specific cells.
- 4. Execute the Data Transfer: Run the macro from the Developer tab to instantly extract and populate your survey results into the spreadsheet.

Frequently Asked Questions
Why is my Excel VBA script unable to open the Word document?
This error typically occurs if the file path specified in your code is incorrect, or if the 'Microsoft Word Object Library' reference has not been enabled in the VBA Editor under Tools > References.
Can I extract data from multiple Word survey documents at once?
Yes. You can enhance your VBA script by incorporating a loop using the `Dir` function or `FileDialog` object. This allows the macro to iterate through an entire folder of Word documents, extracting the data from each and writing it into consecutive rows in your Excel sheet.
How do I find the bookmark names of the drop-down fields in my Word document?
In Microsoft Word, ensure the Developer tab is active. Double-click the drop-down form field to open its 'Drop-Down Form Field Options' dialog box. Look for the 'Bookmark' field under the 'Field settings' section—this is the exact name you must use in your VBA script.
Does this VBA extraction method work if the Word document is password protected for filling in forms?
Yes. VBA can read the `.Result` property of a form field even when the document is restricted to filling in forms. You only need to supply the password in your code if you intend to unprotect the document to modify its core structure or add new fields.




