<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: As promised a real excel 2000 macro thread: Control loop for data refresh in BackOffice Products</title>
    <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433664#M2373</link>
    <description>Um Dexter?&lt;BR /&gt;&lt;BR /&gt;Bunny alert!&lt;BR /&gt;&lt;BR /&gt;Dexter Filmore???&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Steven</description>
    <pubDate>Thu, 02 Dec 2004 23:50:49 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2004-12-02T23:50:49Z</dc:date>
    <item>
      <title>As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433659#M2368</link>
      <description>I have a series of spreadsheets that produce data for a website. They pull some data on some stocks and publish the data in xml format on the website.&lt;BR /&gt;&lt;BR /&gt;The process is simple&lt;BR /&gt;&lt;BR /&gt;Refresh the data then record/save the data in xml format.&lt;BR /&gt;&lt;BR /&gt;Here is the refresh/save macro code:&lt;BR /&gt;&lt;BR /&gt;Sub Macro4()&lt;BR /&gt;'&lt;BR /&gt;' Macro4 Macro&lt;BR /&gt;' Macro recorded 11/30/2004 by YEVKA&lt;BR /&gt;'&lt;BR /&gt;&lt;BR /&gt;'&lt;BR /&gt;    ActiveWorkbook.RefreshAll&lt;BR /&gt;    Application.Run "model.xls!modelpublish"&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Problem: The refresh takes a little time. If I run this code with run macro the publish code runs and the refresh code gets interupted.&lt;BR /&gt;&lt;BR /&gt;I'd like to build some kind of control loop around the refresh so no more code executes until the control loop won't let the next line of code execute.&lt;BR /&gt;&lt;BR /&gt;Here is what I want in English language:&lt;BR /&gt;&lt;BR /&gt;    ActiveWorkbook.RefreshAll&lt;BR /&gt;until refresh is done&lt;BR /&gt;do&lt;BR /&gt;  sleep 1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;if successful (return code 0 in unix-speak) then&lt;BR /&gt;    Application.Run "model.xls!modelpublish"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;I've used Unix control structures.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The current process is manual. That requires me to log onto a computer and do work.&lt;BR /&gt;&lt;BR /&gt;Two goals. Certain Jewish holidays prevent me from operating a computer. I'd like the site to get its update anyway with a windows scheduled job or whatever.&lt;BR /&gt;&lt;BR /&gt;Second goal: I'd like the darn website to get updated even when I'm busy.&lt;BR /&gt;&lt;BR /&gt;This publish part is great. It saves the data, fires up an ftp script and really does a very nice job.&lt;BR /&gt;&lt;BR /&gt;Bunny for some macro code.&lt;BR /&gt;&lt;BR /&gt;Have at it.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Tue, 30 Nov 2004 22:25:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433659#M2368</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-11-30T22:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433660#M2369</link>
      <description>Hi SEP,&lt;BR /&gt;  Is refreshall a function or procedure inside your current workbook??&lt;BR /&gt;&lt;BR /&gt;Ganesh</description>
      <pubDate>Wed, 01 Dec 2004 07:57:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433660#M2369</guid>
      <dc:creator>Ganesh Babu</dc:creator>
      <dc:date>2004-12-01T07:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433661#M2370</link>
      <description>Ganesh.&lt;BR /&gt;&lt;BR /&gt;Its a built in function part of the external data tools that ship with excel. I get the code by doing macro record and pressing the refesh button.&lt;BR /&gt;&lt;BR /&gt;If need be I can post the whole spreadsheet.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 01 Dec 2004 08:59:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433661#M2370</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-12-01T08:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433662#M2371</link>
      <description>Hi SEP,&lt;BR /&gt;  I read some more documents about this refreshall.. and looks like this command sometimes works as an asynchronous (meaning excutes the next steps before this is completed succesfully) command.&lt;BR /&gt;&lt;BR /&gt;So as an workaround.. I was thinking to check for a value in a particular cell which gets updated by refreshAll.. so create a loop and check whether the cell is updated with the particular value and once it is done then we can run the publish procedure..&lt;BR /&gt;&lt;BR /&gt;if this is ok let me know and i can write a script for that..&lt;BR /&gt;&lt;BR /&gt;Ganesh&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 14:16:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433662#M2371</guid>
      <dc:creator>Ganesh Babu</dc:creator>
      <dc:date>2004-12-01T14:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433663#M2372</link>
      <description>Sure this is okay.&lt;BR /&gt;&lt;BR /&gt;I'd like to know how to write a control loop regardless. If you need the spreadsheet, indicate and I'll upload and attach it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 01 Dec 2004 17:00:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433663#M2372</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-12-01T17:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433664#M2373</link>
      <description>Um Dexter?&lt;BR /&gt;&lt;BR /&gt;Bunny alert!&lt;BR /&gt;&lt;BR /&gt;Dexter Filmore???&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Steven</description>
      <pubDate>Thu, 02 Dec 2004 23:50:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433664#M2373</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-12-02T23:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433665#M2374</link>
      <description>This article seems to indicate that if I set background refresh to false, that my code will wait for the query to finish prior to moving on to the next line of code.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffsol02/html/odc_WellkeptSecret.asp" target="_blank"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffsol02/html/odc_WellkeptSecret.asp&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I'm going to try it and see what happens. At this point I have no idea how to do this and will award a bunny for step by step on how to do so.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 07 Dec 2004 12:15:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433665#M2374</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-12-07T12:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433666#M2375</link>
      <description>Since you are not getting much of a response I'll put my 2 cents in.  Have you tried just making two separate macros and then calling each from your main macro?&lt;BR /&gt;&lt;BR /&gt;Something like:&lt;BR /&gt;&lt;BR /&gt;Sub Macro4()&lt;BR /&gt;&lt;BR /&gt;ActiveWorkbook.RefreshAll&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;Sub Macro5()&lt;BR /&gt;&lt;BR /&gt;Application.Run "model.xls!modelpublish"&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have a few other ideas but would need your Excel program and macros to try them out so go ahead and attach it or you can send it directly to me at&lt;BR /&gt;rkinner at att dot net&lt;BR /&gt;&lt;BR /&gt;Most of what little VBA experience I have is in Access but it is about the same.&lt;BR /&gt;&lt;BR /&gt;Ron&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Dec 2004 19:31:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433666#M2375</guid>
      <dc:creator>Ron Kinner</dc:creator>
      <dc:date>2004-12-07T19:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433667#M2376</link>
      <description>Ron,&lt;BR /&gt;&lt;BR /&gt;Thanks for posting in.&lt;BR /&gt;&lt;BR /&gt;I have discovered that each data area in the spreadsheet has a property for background data refresh. It apparently defaults to enable.&lt;BR /&gt;&lt;BR /&gt;I just went through a spreadsheet disabled it and got a macro to run and it waited for the data to update before going to the next step.&lt;BR /&gt;&lt;BR /&gt;So apparently a control loop, may not be necessary. I'm still looking to make further improvements though so I'm attaching my spreadsheet.&lt;BR /&gt;&lt;BR /&gt;I'm wondering now how to program the Windows scheduler to kick the spreadsheet once a day running a particular macro. &lt;BR /&gt;&lt;BR /&gt;I can now actually set up the websites stock indices to update themselves during the day, though that will tie up a computer.&lt;BR /&gt;&lt;BR /&gt;I'm wondering whether the better idea is to use a control loop to run the collect and publish functions, leaving the spreadsheet open all day long.&lt;BR /&gt;&lt;BR /&gt;Here is the spreadsheet I just fixed. This is not closed and I'm handing Ron a solution quality pointage, because you met the original question critera. Thanks for letting me get to point assignment prior to Merijn's statistics.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 07 Dec 2004 19:52:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433667#M2376</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-12-07T19:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: As promised a real excel 2000 macro thread: Control loop for data refresh</title>
      <link>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433668#M2377</link>
      <description>Hi SEP,&lt;BR /&gt; I am really sorry for not sending the control loop before.. here is one which u can use it..&lt;BR /&gt;&lt;BR /&gt;Sub controlloop()&lt;BR /&gt;'Test&lt;BR /&gt;Dim strdatetime As Date&lt;BR /&gt;Dim curdatetime As Date&lt;BR /&gt;Dim intdiff As Integer&lt;BR /&gt;strdatetime = Now&lt;BR /&gt;intdiff = 1&lt;BR /&gt;Do While True&lt;BR /&gt;    curdatetime = Now&lt;BR /&gt;    intdiff = DateDiff("n", strdatetime, curdatetime)&lt;BR /&gt;    If intdiff &amp;gt;= 1 Then&lt;BR /&gt;        strdatetime = Now&lt;BR /&gt;        'ActiveWorkbook.ActiveSheet.Cells(1, 1).Text = curdatetime&lt;BR /&gt;        msgbox curdatetime&lt;BR /&gt;        Exit Do&lt;BR /&gt;    End If&lt;BR /&gt;Loop&lt;BR /&gt;'yyyy Year&lt;BR /&gt;'q Quarter&lt;BR /&gt;'m Month&lt;BR /&gt;'y Day of year&lt;BR /&gt;'d Day&lt;BR /&gt;'w Weekday&lt;BR /&gt;'ww Week&lt;BR /&gt;'h Hour&lt;BR /&gt;'n Minute&lt;BR /&gt;'s Second&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The above loop is an infinite loop which will exit only if "Exit Do" statement is called. So u can right a condition when u want to come out of the loop..&lt;BR /&gt;&lt;BR /&gt;Also i have put in a condition for running the data refresh &amp;amp; publish to for every minute (assuming they complete before 1 min)... u can change it to hours or days based on your frequency..&lt;BR /&gt;&lt;BR /&gt;hope this helps..&lt;BR /&gt;&lt;BR /&gt;Ganesh&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Dec 2004 12:22:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/backoffice-products/as-promised-a-real-excel-2000-macro-thread-control-loop-for-data/m-p/3433668#M2377</guid>
      <dc:creator>Ganesh Babu</dc:creator>
      <dc:date>2004-12-08T12:22:03Z</dc:date>
    </item>
  </channel>
</rss>

