Invoke VBA activity does not work after making changes in the .txt file

Hello team,
I have a simple VBA.txt file with a vba code. After adding one line to it, the “Invoke VBA” activity does not work any more:

image

The error I’m getting is:
Invoke VBA: Cannot run the macro ‘ChangeColumnType’. The macro may not be available in this workbook or all macros may be disabled.

This is how the Invoke VBA activity looks like:

image

Of course I’m inside the Excel Application Scope:

image

I have spent multiple hours on troubleshooting this but not found any clue on forum. You are my last resort, otherwise I will have to use click activities to do this which is not optimal

Any hints will be greatly appreciated!

Try by Recording the macro again and save in txt file.

Also make sure your macros are enabled in Microsoft excel.

Hi @dbukk ,

Try this below code in attached file,
ChangeColumnType.txt (226 Bytes)

Sub ChangeColumnType()

'Sheet on which we have to perform operations
Sheets("Sheet1").Activate

'Changing column format
ActiveSheet.Range("B:B").NumberFormat = "@"
ActiveSheet.Range("L:L").NumberFormat = "@"

End Sub

Hope this may help you :slight_smile:

Hello @Manish540 & @sarvesh.b

This did not help. I think that the issue is that in the Excel Application Scope I’m creating a new file:
in_Config(“Main_Path”).ToString + “.xlsx”
image

image

The macros are enabled in MS Excel settings.

I have also tried replacing “.xlsx” with “.xlsm” but nothing has changed…

When running the VBA code the modules are being generated; there are also strange signs before the Sub:

image

See That in your excel file the below setting in enabled or not.

My settings look as follows:

@dbukk

Create a new text file in a different location and copy the code into that file…

Then delete the old one and copy the new file into that location and check

Cheers

Hi @Anil_G

Bingo! Replacing the files solved the issue. Don’t know why it is so, maybe some kind of a bug.

Anyway, thanks a lot for suggestion.

Regards,

1 Like

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