The macro may not be available in this workbook or all macros may be disabled even after modified trust center

Hi,

I am getting this error:

“The macro may not be available in this workbook or all macros may be disabled”

I have enabled “Trust access to the vba project model” and still, getting the same error.

Any help would be appreciated.

May I. Know which activity is used buddy
And by the way
Happy birthday
Cheers @mesalcan

I am using “Invoke VBA” activity.

and Thanks! for both

@Palaniyappan

1 Like

Fine
I hope the file is not having any macro to be executed like it is not a macro enabled file .xlsm
—fine try to pass that excel file path as input to excel application scope and inside the scope use execute macro activity by passing the method in that activity property panel

That would work for sure
Cheers @mesalcan

Not sure I am getting what you are saying.

I have an invoke VBA activity within an excel scope, as per following image.

image

The excel file I am using, is a simple .xls
@Palaniyappan

1 Like

Yah that’s the reason
Usually a macro enabled file will be file extension .xlsm
As this is just a normal .xls excel file this error is popping up

Cheers @mesalcan

I have looked in how to enable macros in Excel on Microsoft and they can be enabled even on “.xls”. I have done that and the error still persist.

Thanks!

@Palaniyappan

.xls File can take macros only when we run explicitly using a vb script
and here in uipath we use INVOKE VBA with excel application scope where in the property panel, we can mention the file path of a text file having the vb script and the method name

else if the excel itself has a macro in it, then the file extension would be like .xlsm

hope this would help you

Cheers @mesalcan

this is wrong. vba should be in .txt file. written in notepad.

I am running a vb script within an excel application scope. There is no macro inside the excel file, but getting the error previously mentioned when invoking the vb script.

Thanks!

@Palaniyappan

The vb script has been created using Notepad++.

Thanks!

@Petar_Soce

Fine
may i know what error you were getting
Cheers @mesalcan

Cannot run the macro “function name”. The macro may not be available in this workbook or all macros may be disabled.

@Palaniyappan

1 Like

You have to change the file format you are invoking.
Your macro should be in .txt file
image

I have another process that calls the “vbs” without having issues; but I have been unable to find any difference, other than the one working is a “Sub” and mine is a “Function”.

@Petar_Soce

I changed to text file and getting same error.

@Petar_Soce

I struggled for quite some time with this.
If your code file has this at the top "Attribute VB_Name = “Module1” - remove it and just name the Sub to be the same as the EntryMethodName that you specified in the Invoke VBA file.
For example VBA File -
Sub Main()
Sheets(“Client Quote”).Tab.ColorIndex = 4
End Sub
image

1 Like