Jump to content

how do i wait till macro is finished to run auto it


yasha
 Share

Recommended Posts

$oExcel = ObjCreate("Excel.Application")                   ; Create an Excel Object
$oExcel.Visible = 1                                        ; Let Excel show itself
$oExcel.Workbooks.Open('J:\OPS\OPS_Share\Planners\7 - Automation\All Report macro.XLSM',0)
$oExcel.ActiveWorkbook.Application.Run("ECONOMICSTOCKCOMPILE")
$oExcel.ActiveWorkBook.Close
$oExcel.Quit
WEnd
;ProcessWaitClose("Proce.exe")
WinWaitActive(""& $YY & $MM & $DD & "range_Economic_stock.xls")
$oExcel = ObjCreate("Excel.Application")                   ; Create an Excel Object
$oExcel.Visible = 1  ; Let Excel show itself
$oExcel.ActiveWorkbook.SaveAs (  $sFileSelectFolder &"\"& $YY & $MM & $DD & " range_Economic_stock.xlsx",51,"","",False,False)
$oExcel.ActiveWorkBook.Close
$oExcel.Quit

my program runs fine only problem is that it does not wait till macro finishes any idea how wait until macro finishes .

Link to comment
Share on other sites

@FrancescoDiMuro

ah thanks for your replies turns out i forget to add save function in macro so it closed the program after the macro ran but did not save my file so the autoit got stuck waiting for excel to activate lol .

Edited by yasha
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...