Execute Macro using VB Script

Hi,

I was wondering is there’s a way to run macro in .xlsx file? I need to run macro with a different file everyday but using the same macro. I tried to save the macro in a notepad and save it as .vb file.

Using excel application scope activity and invoke vb script activity to run the macro.

When I run it nothing happen to the excel which btw if I run the macro in the same file using .xlsm file it works.

Example:

But my everyday file is in this format:
File1.xlsx
File2.xlsx

Macro code:
Macro.vb

Macro works only in this file using execute macro activity:
File1.xlsm

1 Like

Hi @jenkim

May the below site help you
refer the below website

I have attach the workflow which will help you
InvokeVBA Example.zip (15.7 KB)

Hope this may help to solve your query
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Hy @jenkim,

You can reference another excel file in an excel macro.
You could create an excel xlsm to call the macro.
If you wish I can prepare something to you

Please let me know

Regards

I’m sorry I miss this workflow that you have created and just check on the link that you gave and trying to understand it.
Today only I noticed it and I tried using your solution and it works.

I just save the macro in a txt file and invoke VBA. It works. Thank you so much @Pratik_Wavhal :grin:

1 Like

Hi @William_Blech_Sister,

I have found my solution for this. Thank you for your interest in providing the solution. :smiley:

1 Like

Hi @jenkim

You are Welcome :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

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