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).
I figured out my issue. I would get this error if I created a txt file within Studio and then used it within the invoke VBA activity. I had to open Notepad, create the VBA code, then save the file to the project. That is the only way I could get around the error. Even after doing that, if I opened the txt file within Studio, the error would return. Has to be a bug in Studio.
@Phillip_Williams , Thanks for bringing this topic up. I ran into this error recently as well. In my case, I found that I had accidentally introduced a syntax error into the vba code when I edited it in notepad to add arguments ( Double) instead of ( as Double).
It appears that at least in my case, UiPath is throwing the wrong error (i.e. the one about enabling Trust…) instead of something about the fact that the vba itself has an error in it.
Yes I tried this but still not working.I had some error with excel file I deleted that recreated new excel file and the issue got resolved thanks anyway.