Execute Macro: Cannot run the macro ‘This workbook.macro1’. The macro may not be available in this workbook or all macros may be disabled.
when i run my macro i am getting this error
I have done file > options > trust center >enable all macro and trust access the VBA too but still i m getting this error .
and i m running this commands in notpad and exporting it to my vb ,these commands are running with my excel but its show me an error with uipath
Sub CreatDropDownList()
’
’ CreateDropDownList Macro
’
’
Range(“A1:D375”).Select
Range(“A1”).Activate
End Sub
Sub Macro1()
’
’ CreateDropDownList Macro
’
’
Range("D2").Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Formula1:="H ,C , Cel"
End Sub
Your exception tells me that you are trying to run the macro in the workbook that does not exist.
You can use “Get workbooks” activity to get a list of your all workbooks and then see if there was a typo in the property Invoke Macro
Copy your vba script and paste it in demo.vbs.
Use excel application scope to open your excel file
Use Invoke VBA activity and pass “CreatDropDownList” to Entry method name parameter.