Sign in to follow this  
Followers 0
afzalw

Run Multiple Excel Modules in Autoit

5 posts in this topic

I have around 20 Modules in Excel and I want to run one after another as a process,

1) Whats the code for running module of Excel.

2) How can I make sure that next module runs after the previous module has been completed, as each module can take around 2-5 minutes to complete.

Thanks,

Share this post


Link to post
Share on other sites



afzalw,

I would recommend using this UDF the functions probably don't return until they've completed but if you have further problems please let us know. Also remember to search before posting. ;)

Anonymous

1 person likes this

Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites

afzalw,

I would recommend using this UDF the functions probably don't return until they've completed but if you have further problems please let us know. Also remember to search before posting. ;)

Anonymous

So I have another problem like I said I have multiple Macros but Autoit is only running one Macro. It does not Run the other Macro.

Another thing I read that its better to call macro if you want to finish running process of previous macro. How do I use Call here.

#include <Excel.au3>
        $oExcel = ObjCreate("Excel.Application")             ; Create an Excel Object

        Local $sFilePath1 = @ScriptDir & "\File.xlsm" ;This file should already exist

        Local $oExcel = _ExcelBookOpen($sFilePath1)       ;Opening the file

With $oExcel
.Run ("Macro1")
ProcessWait ( "" , 2000 )
.Run ("Macro2")
EndWith

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

afzalw,

As mentioned

I think that

Sleep(1000) ; Value is in milliseconds
; - Maybe close the first instance and then start another?
_ExcelBookClose($oExcel)
Is going to be the simple solution. However others on these forums may have a better answer.

Anonymous

Edited by Decipher

Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites

According to MSDN: "The Run method returns whatever the called macro returns."

So I think it's not necessary to wait for x seconds before you can run the second macro.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  
Followers 0