excel - Getting vba to wait before proceeding -


i need update 4 different workbooks, collect data bloomberg. tried construct new workbook automatically open them , code within workbooks activated since code gets activated whenever workbook opens. macro opens workbooks @ same time , update taking long when open @ same time. tried use command "doevents" , "application.wait (now + timevalue("0:03:30"))", not work. them open 1 @ time, let calculation in specific workbook end before opening next next workbook.

here code:

    sub updateworkbooks()      'quick financial longer series      workbooks.open ("g:\fonds\quick financials_longer series.xlsb")      application.wait (now + timevalue("0:03:30"))      'quick financial      workbooks.open ("g:\fonds\quick financial\auto\quick financials.xlsb")      application.wait (now + timevalue("0:03:30"))      'quick intra corr (sx5e)      workbooks.open ("g:\fonds\quick financial\auto\quick intra corr(sx5e).xlsb")      application.wait (now + timevalue("0:03:30"))      'spx sector correlation      workbooks.open ("g:\fonds\spx sector correlation.xlsb")      application.wait (now + timevalue("0:03:30"))        workbooks("updateworkbooks.xlsb").close savechanges:=true        end sub 

the application.calculationstate may here. wrap in function, return state, , use until. not sure of infinite loop possibilities, may advisable add retry counter also.

 select case application.calculationstate     case 0: strcalculationstate = "calculating"     case 1: strcalculationstate = "done"     case 2: strcalculationstate = "pending"  end select 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -