Invoke VBA: Cannot run the macro 'SumTwoNumbers'. The macro may not be available in this workbook or all macros may be disabled

Hello Team,

Tried running the macro via “Invoke VBA” inside an Excel Application scope.

But I get the error message as shown in the below image.

“Invoke VBA: Cannot run the macro ‘SumTwoNumbers’. The macro may not be available in this workbook or all macros may be disabled”

Thanks
Minal Patil

Hi @minal.patil ,

Use this below vba code to sum the numbers,

Function SumTwoNumbers(Numberl As Integer,Number2 As Integer)As Integer
SumTwoNumbers = Numberl+Number2
End Function

Find the below screenshot for your reference,

Hope this may help you :slight_smile:

7 Likes

It’s working thanks

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