excel vba - how can i pause a macro wile IE generated file is open -


my macro generating report in excel 2003 format internet application. want read file , generate metrics data. while excel file generated ie application, macro executes beyond can read ie generated excel file. want pause macro until ie generated excel file complete.

i have tried application.wait command stops generating file until wait over.

can me?

it helpful if posted code, see trying. in mean time, here code wrote years ago, should work want do.

    'this block holds program until output file ready outfile = filepath & "\" & yfttablefile  = 0 set fo = createobject("scripting.filesystemobject") until fo.fileexists(outfile) 'loop until output file created, infinity if there problem     application.wait (now + timevalue("0:00:02")) 'holds program 2 seconds     doevents     = + 1     if (i = 30)         msgbox ("no output file created within 60 seconds")         exit sub     end if loop application.wait (now + timevalue("0:00:03")) 'holds program 2 seconds ensure file complete 

be sure adjust wait times , counters required.

if doesn't work , know end of file looks like, loop end of file several times using code this:

file = filepath & "\" & filename 'path initial temps file  fn = freefile open file input fn  until eof(fn) 'reading in temperatures file      line input #fn, inpline     inttemp = right(inpline, 9)      if (inttemp <> "")         oldtemps(i) = cdbl(inttemp)     end if  loop  close fn 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -