How to Insert Multiple Dropdown Selections into the Current Word Document via VBA
Question details
The user needs a VBA macro to insert multiple dropdown selections directly into the active Word document rather than generating a new document.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Running a VBA macro to transfer selected items from a dropdown list into a specific report.
- Observed behavior
- The macro incorrectly executes 'Documents.Add', which opens a new blank document and inserts the dropdown selections there instead of the currently active report.
Ensure you have saved your current document to prevent data loss, and verify that the Developer tab is enabled in your top ribbon so you can access the VBA editor.
Modify the VBA Code to Target the Active Document and Cursor
By updating the VBA document reference and insertion method, you can force the macro to output data exactly where your cursor is placed in the current report.
The reason a new document opens is due to the generic 'Documents.Add' command. Changing the document reference object and updating the insertion target will redirect the macro's output.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor, and locate the module containing your macro.
Find the line of code that reads 'Set doc = Documents.Add' and replace it entirely with 'Set doc = ActiveDocument'. This prevents Word from creating a new file.
Locate the command 'doc.Content.InsertAfter' and change it to 'Selection.Range.InsertAfter options(optionIndex) & vbCrLf'. This ensures the text drops directly at your active cursor location.

Use Bookmarks for Fixed Insertion Locations
If your report requires the dropdown selections to be placed at highly specific, fixed areas rather than the current cursor position, using Bookmarks is the best approach.
Run VBA Macros Seamlessly in WPS Writer
WPS Office provides robust document editing and automation features. With high compatibility for Microsoft Word formats, you can run, edit, and manage your VBA macros effectively within WPS Writer to automate your workflow without hassle.
- 1. Open WPS Writer: Launch WPS Writer and open the document where you want to execute your macro.
- 2. Access the Developer Tab: Navigate to the Developer tab on the top ribbon. If it is not visible, enable it from the customized ribbon settings.
- 3. Open the VBA Editor: Click on the 'Macros' or 'Visual Basic' icon to open the code editor. Paste your corrected macro code targeting ActiveDocument and run it directly.

Frequently Asked Questions
Why does my macro create a new document every time I run it?
If your macro uses the command 'Documents.Add', it is specifically instructed to create a new blank document upon execution. Changing this command to 'ActiveDocument' tells the script to use the file currently open on your screen.
How can I insert VBA output at the exact cursor position?
Instead of targeting the entire document content using 'doc.Content', you should use the 'Selection.Range' object in your VBA code. Using 'Selection.Range.InsertAfter' will drop your text precisely where the text cursor is blinking.
What is 'vbCrLf' used for in Word VBA?
In VBA, 'vbCrLf' stands for 'Visual Basic Carriage Return Line Feed'. It is used to insert a line break or move to the next line, ensuring that multiple dropdown selections appear on separate lines instead of clumping together in one continuous string.




