VB Method arguments must be enclosed in parentheses

1.1k Views Asked by At

I have the following code to insert a drop down list in Excel. Note I am calling this code via Blueprism.

GetInstance(handle).Activecell.Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,Formula1:=("Yes,No")

This is producing the following error

Method arguments must be enclosed in parentheses
1

There are 1 best solutions below

0
On BEST ANSWER

Initial error was being caused by the lack of brackets. However, this prompted further errors around the Excel constants.

Final code:

GetInstance(handle).Activecell.Validation.Add (Type:=3, AlertStyle:=1,Formula1:=("Yes,No"))