How to use macro activity

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


End Sub

Sub Macro1()

’ CreateDropDownList Macro

Range("D2").Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Formula1:="H ,C , Cel"

End Sub

can anyone help

Hi @Raina_Ocean_Sanjay

Is the macro present in the excel file? (file extension would be .xlsm)

if yes, then use the Execute Macro activity

If no, then use the Invoke VBA activity.

Hi @Raina_Ocean_Sanjay

Have a look on it


The macro is in excel file and the extension of it is also xlsm
but still with excute macro it is throwing me an error


Please share the screenshot of your workflow, also the properties of the execute macro activity

@Raina_Ocean_Sanjay Please go through the attached file for the basic implementation of execute macro (11.9 KB)

When you save your file is it .xlsx or is it .xlsm ?
It should be the 2nd one.

the excel save is in xlsm after executing the macro

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


Some things to follow before using Execute Macro activity:

  1. Enable macro from trust center settings in Excel app.
  2. Use execute macro activity inside Excel application scope.
  3. Keep .vbs as extension of macro file.

the sheets are there

already did this
Still i m getting an error
Regards ,

Can you do following steps?

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.


the process is running but it is now not creating a drop down


Thank you for the solution :slight_smile:

Regards ,

Pleasure is all mine.
Keep posting if you are having any doubts.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.