Jump to content

Run Multiple Excel Modules in Autoit


Recommended Posts

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,

Link to comment
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
Link to comment
Share on other sites

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

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...