<Excel Macro Issue> Invoke VBA - Macro1: Cannot run the macro 'Macro1'. The macro may not be available in this workbook or all macros may be disabled

I am facing this issue for long!
File is saved in .xlsx format.
No macros or VBA script is inside the excel.

I am using all the macros/formulae saved in text file and then using Excel application scope and inside it Invoke VBA.

Any help would be highly appreciated.

Hi @anjasing

Try enabling the Macros in the .xlsx file.

Step by step process to enable macro -
→ Click on File option in ribbon bar
→ Click on Options

→ Excel options window opens in that select the Trust center and hit on the Trust center settings

→ Click on Macro Settings
→ Select the Enable VBA Macros and Enable the option Enable Excel 4.0 macros when VBA Macros are enabled
→ Enable the option Trust access to the VBA Project Object model

Hope it helps!!

1 Like

Hi @mkankatala ,

It’s a macro enabled file.

HI @mkankatala ,

image

I’ve already followed this. But I can’t enable 4th option as it’s dangerous and without enabling also, previously it worked perfectly fine.

It gave issue when I added something in text file which contain VBA script

If possible could you share the vb code then I’ll check is there any error in the code @anjasing

I’ve saved again the content of VBA script in new text document and renamed it. Not sure about the reason, but this worked.

That’s why I asked you about to share the workflow and code. @anjasing

Anyway it’s working.

Happy Automation!!

1 Like

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