Possible to fill MS Word fields, checkboxes, dropdowns?

uiautomation
word

#1

Haven’t seen any demo videos or forum posts that show interaction with MS word fields, checkboxes, and dropdowns. Is it possible?

When recording, I see that the recorder recognizes the MS Word client area as one single chunk. I’ve generally been able to write/replace a blob of text into that, but it’s not immediately obvious how we might interact with an MS Word doc having field controls within the client area.

I’ve tried to manually pre-type and save tokens into desired fields, then use the MS Word Replace Text activity… and while this works with a normal client area (having only text)… it throws a COM exception error about “protected area” when I try replacing values that exist in fields.

Would a combination of find image/click relative/type into work here… or is there an easier way?


#2

Solved the problem for my own use case.

Fortunately… my MS Word fields are arranged in multiple columns. The first column contains a text “label” for each row. When I use “Click Image” to click on any given row’s label (since there is no other way to click it by control Id, etc.), it automatically places focus into the first text field of that row. The label acts as a “key” to the row. This approach can consistently find & click any given key.

TEXT FIELDS
I can either Type Into if I want to fill the field in the first column, or I can use any number of tabs (via Type Into) to move to other fields in the same row.

DROPDOWNS
If I encounter a dropdown that must be filled, I can use either F4 or alt-down arrow to open it… then use the down arrow to select my desired value, then enter to commit (all via Type Into). Obviously this forces my robot to have knowledge of which items are in which dropdowns, and use the appropriate number of down arrow clicks to get to the right item.

CHECKBOXES
If I encounter a checkbox, I can simply use Type Into to type “x” to select/deselect it.

Problem solved as long as the template doesn’t change.


#3

Thanks for sharing! :slight_smile: