Invoke VBA - trust access and cannot run macro error

Hi Everyone,

I am getting the below error when using Invoke VBA activity in my Studio X project. I am trying to get the hyperlink URL value stored in excel rows and trying to use the VBA script to get the value returned.

The error is the following:
“UiPath.Excel.ExcelException: In order for this activity to work, Trust Access to the VBA project object model must be enabled from Excel (File > Options > Trust Center > Trust Center Settings > Macro Settings > Select the Trust Access to the VBA project object model check box) —> System.Runtime.InteropServices.COMException: Cannot run the macro ‘GetURL’. The macro may not be available in this workbook or all macros may be disabled.”

I’ve already made sure that Excel is correctly set but I still get the error. I have also tried the method name with/without quotes as well.
I’m attaching screenshot of the VBA function, Excel settings & UI Path Invoke VBA activity as well (unable to attach more than 1 image as I am a new user).

Any help is appreciated. Thanks in advance.

1 Like

HI @santosh.kannan

Welcome to Uipath community

Have you done all the things in the below steps :

Step 1 Open an Empty excel or any excel file
Step 2 Goto File-> Option
Step 3 Goto Trust Center → Trust Center Settings → Trusted Locations
Step 4 Click on Add new Location and browse for the folders (Project Location) and check the Sub folder of this location also trusted and click on ok
Step 5 The Location will be added in the list of trusted location and click on Ok
Step 6 Goto Trust Center → Trust Center Settings → Macro Setting, enable the Trust access to VBA project object model and click on Ok

Regards
Gokul

1 Like

Hi @Gokul001 ,

I have done Step 5 and Step 6(i had this setting enabled already) but still getting the same error.

1 Like

Have you done Step 4? @santosh.kannan

Yes I have done Step 4 to add the location of the Project Folder as a trusted location and check to include sub-folder.

@Gokul001 im still facing the issue, is there anything else i can try?

Did you get this resolved? I am facing the same issue.