Hi Team,
I am working on Word Automation where I have to select one value in dropdown, Please see the image below.
Hi Team,
I am working on Word Automation where I have to select one value in dropdown, Please see the image below.
On word you have dropdown?
If so then try using macros instead of ui automation that would be better
Cheers
Hi @Anil_G ,
Thanks for reply, I am trying the same it would be helpful if you have any samples.
This is a way to call mord macro from excel
And this is a way to select dropdown using macro
Cheers
To select a value in a dropdown using a macro in UiPath within Word Automation, you can use the following general steps:
Create a Macro in Word:
Open your Word document, navigate to the “View” tab, and click on “Macros” to record a macro. Record the steps of selecting the value in the dropdown. Save the macro with a name.
Invoke VBA Macro in UiPath:
In UiPath, use the “Invoke VBA” activity to execute the recorded macro. This activity allows you to execute VBA code directly within the Word application.
Sub SelectDropdownValue()
' Your recorded macro code to select a value in the dropdown
End Sub
Execute Macro in UiPath:
Use the “Invoke VBA” activity in your UiPath workflow to call the recorded macro.
Pass Parameters (if needed):
If your recorded macro requires parameters (e.g., the value to be selected), you can pass these parameters from UiPath to the VBA code.
Sub SelectDropdownValue(selectedValue As String)
' Your recorded macro code to select the specified value in the dropdown
End Sub
In UiPath, use the “Invoke VBA” activity and provide the required parameters.
Note: Ensure that your Word document security settings allow the execution of macros, and the macro-enabled document has been saved with the necessary permissions.
Remember that UI Automation (like using selectors) might also be an option if the Word document does not allow direct macro execution or if the dropdown is not accessible through VBA. If using UI Automation, consider the stability and reliability of your automation, and handle potential changes in the document structure.