Jump to content
Sign in to follow this  
gkeppler

Run excel macro within autoit

Recommended Posts

gkeppler

Hey all, is there an way to call an excel macro by name within autoit? i'm currently just sending my hot key after opening the sheet with macro stored in it. Thanks.

Share this post


Link to post
Share on other sites
PsaltyDS

Hey all, is there an way to call an excel macro by name within autoit? i'm currently just sending my hot key after opening the sheet with macro stored in it. Thanks.

Look at the _Excel* functions of the Excel.au3 UDF. Once you open the workbook, you should be able to do $oExcel.Run("Macro_Name").

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
gkeppler

Thanks. you guys are quick.

Look at the _Excel* functions of the Excel.au3 UDF. Once you open the workbook, you should be able to do $oExcel.Run("Macro_Name").

:)

Share this post


Link to post
Share on other sites
mpcluever

I'm not finding that function in Excel.au3

Share this post


Link to post
Share on other sites
PsaltyDS

I'm not finding that function in Excel.au3

The use of the object method $oExcel.Run("Macro_Name") is not in the UDF. The .Run method is part of the Excel workbook object.

I meant use the function _ExcelBookAttach(), _ExcelBookNew(), or _ExcelBookOpen() to get the object reference in $oExcel. Then, you can run a macro by doing $oExcel.Run("Macro_Name").

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
mpcluever

Excellent. Works perfect. Thanks!!

Share this post


Link to post
Share on other sites
martmeister

The use of the object method $oExcel.Run("Macro_Name") is not in the UDF. The .Run method is part of the Excel workbook object.

I meant use the function _ExcelBookAttach(), _ExcelBookNew(), or _ExcelBookOpen() to get the object reference in $oExcel. Then, you can run a macro by doing $oExcel.Run("Macro_Name").

:P

I have tried the $oExcel.Run("Move")

Move being my macro name and it gives me an error: Expected a "a" in assignment statement.... What is wrong

Do I need more than one line of code to run this macro?

Share this post


Link to post
Share on other sites
PsaltyDS

I have tried the $oExcel.Run("Move")

Move being my macro name and it gives me an error: Expected a "a" in assignment statement.... What is wrong

Do I need more than one line of code to run this macro?

Don't double post. Answered in your own topic.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×