<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Async XmlHttp calls</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 23:42:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: P</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-66868</link>
		<dc:creator>P</dc:creator>
		<pubDate>Mon, 10 Oct 2011 09:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-66868</guid>
		<description>&lt;p&gt;an error just appear in my VB 2010&lt;br&gt;
when I run the test module&lt;br&gt;
user-defined type not defined&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>an error just appear in my VB 2010<br />
when I run the test module<br />
user-defined type not defined</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-39173</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Tue, 28 Apr 2009 21:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-39173</guid>
		<description>&lt;p&gt;This is great, but I&#039;m having trouble get the asynchronous xmlhttp to work with excel.&lt;/p&gt;
&lt;p&gt;Instead of the msgbox, I would like it to return the response text (the html) to the calling cell once it has been loaded. I&#039;ve tried many things, but they don&#039;t seem to work.&lt;/p&gt;
&lt;p&gt;I&#039;m assuming that I need to pass a reference to the  CXMLHTTPHandler onreadystatechange method, but I&#039;m not sure which one.&lt;/p&gt;
&lt;p&gt;Ideally I would like a function Test(pURL as String) which returns the html text found at pURL&lt;br&gt;
Before it is loaded it could return &quot;still loading&quot;, although this is not necessary&lt;/p&gt;
&lt;p&gt;Thank you for your help.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This is great, but I&#8217;m having trouble get the asynchronous xmlhttp to work with excel.</p>
<p>Instead of the msgbox, I would like it to return the response text (the html) to the calling cell once it has been loaded. I&#8217;ve tried many things, but they don&#8217;t seem to work.</p>
<p>I&#8217;m assuming that I need to pass a reference to the  CXMLHTTPHandler onreadystatechange method, but I&#8217;m not sure which one.</p>
<p>Ideally I would like a function Test(pURL as String) which returns the html text found at pURL<br />
Before it is loaded it could return &#8220;still loading&#8221;, although this is not necessary</p>
<p>Thank you for your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-27026</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Tue, 04 Sep 2007 02:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-27026</guid>
		<description>&lt;p&gt;A final note that setTimeouts might need to be called to override the default timeout of 30 seconds if you use ServerXMLHTTP&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>A final note that setTimeouts might need to be called to override the default timeout of 30 seconds if you use ServerXMLHTTP</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-26015</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Fri, 27 Jul 2007 19:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-26015</guid>
		<description>&lt;p&gt;Just found out that changing XMLHTTP to ServerXMLHTTP overcomes this limit.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Just found out that changing XMLHTTP to ServerXMLHTTP overcomes this limit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-26012</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Fri, 27 Jul 2007 18:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-26012</guid>
		<description>&lt;p&gt;Good stuff!  Except that only up to two async calls to each FQDN can be launched at once (the rest get blocked), due to a Microsoft WinInet limitation &lt;a href=&quot;http://support.microsoft.com/kb/183110&quot; rel=&quot;nofollow&quot;&gt;http://support.microsoft.com/kb/183110&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Good stuff!  Except that only up to two async calls to each FQDN can be launched at once (the rest get blocked), due to a Microsoft WinInet limitation <a href="http://support.microsoft.com/kb/183110" rel="nofollow">http://support.microsoft.com/kb/183110</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-22364</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 08 Feb 2007 16:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-22364</guid>
		<description>&lt;p&gt;This works great.  However: I experienced problems running into cache / caching.  If you keep getting the same response, when you know your feed has been updated, add this line after the Open method and before the Send method:&lt;br&gt;
xmlHttpRequest.setRequestHeader &quot;If-Modified-Since&quot;, &quot;Sat, 1 Jan 2000 00:00:00 GMT&quot;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This works great.  However: I experienced problems running into cache / caching.  If you keep getting the same response, when you know your feed has been updated, add this line after the Open method and before the Send method:<br />
xmlHttpRequest.setRequestHeader &#8220;If-Modified-Since&#8221;, &#8220;Sat, 1 Jan 2000 00:00:00 GMT&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Glancy</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-21280</link>
		<dc:creator>Doug Glancy</dc:creator>
		<pubDate>Mon, 16 Oct 2006 04:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-21280</guid>
		<description>&lt;p&gt;Juan Pablo,&lt;/p&gt;
&lt;p&gt;Thanks for the explanation - that&#039;s interesting.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Juan Pablo,</p>
<p>Thanks for the explanation &#8211; that&#8217;s interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juan Pablo Gonzalez</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-21279</link>
		<dc:creator>Juan Pablo Gonzalez</dc:creator>
		<pubDate>Mon, 16 Oct 2006 02:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-21279</guid>
		<description>&lt;p&gt;Doug,&lt;/p&gt;
&lt;p&gt;The XMLHTTP has the option to be synchronous or asynch built in.  It&#039;s the third argument in the .open method:&lt;/p&gt;
&lt;p&gt;xmlHttpRequest.Open &quot;GET&quot;, url, True&lt;/p&gt;
&lt;p&gt;which is actually&lt;/p&gt;
&lt;p&gt;xmlHttpRequest.Open method, url, asynchronous, [username], [password]&lt;/p&gt;
&lt;p&gt;What happens in javascript is that you fire the request to the url, and then assign another function to continue with the code when the call is complete, something similar in VBA would be to use the Application.OnTime to fire a specific procedure at a specific time.&lt;/p&gt;
&lt;p&gt;So in javascript you have:&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; startURL() {&lt;br&gt;
&#160; &#160;var xmlHttp;&lt;br&gt;
&#160; &#160;//some code &lt;span class=&quot;kw1&quot;&gt;to&lt;/span&gt; initiate the &lt;span class=&quot;kw1&quot;&gt;object&lt;/span&gt;&lt;br&gt;
&#160; &#160;xmlHttp.onreadystatechange = cleanUp;&lt;br&gt;
&#160; &#160;//some other code&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; cleanUp() {&lt;br&gt;
&#160; &#160;alert(&lt;span class=&quot;co1&quot;&gt;&#039;I&quot;m finished !&#039;);&lt;br&gt;
&lt;/span&gt;}&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;With VBA, you can&#039;t assign a function to this property of the object, nor a string, nor anything else.  But it will take an object, any object apparently, and it will call its default property when the readyState change property changes.&lt;/p&gt;
&lt;p&gt;That&#039;s why you need to build the extra class module, to be able to control when the object has changed its status.&lt;/p&gt;
&lt;p&gt;You don&#039;t actually need the class module to make it async, as I said, you could just stick it inside of a Do Loop like&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;While&lt;/span&gt; xmlHttpRequest.readyState &lt;&gt; 4&lt;br&gt;
&#160; &#160;DoEvents&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;but this is not very async IMO...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Doug,</p>
<p>The XMLHTTP has the option to be synchronous or asynch built in.  It&#8217;s the third argument in the .open method:</p>
<p>xmlHttpRequest.Open &#8220;GET&#8221;, url, True</p>
<p>which is actually</p>
<p>xmlHttpRequest.Open method, url, asynchronous, [username], [password]</p>
<p>What happens in javascript is that you fire the request to the url, and then assign another function to continue with the code when the call is complete, something similar in VBA would be to use the Application.OnTime to fire a specific procedure at a specific time.</p>
<p>So in javascript you have:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">function</span> startURL() {<br />
&nbsp; &nbsp;var xmlHttp;<br />
&nbsp; &nbsp;//some code <span class="kw1">to</span> initiate the <span class="kw1">object</span><br />
&nbsp; &nbsp;xmlHttp.onreadystatechange = cleanUp;<br />
&nbsp; &nbsp;//some other code<br />
}</p>
<p><span class="kw1">function</span> cleanUp() {<br />
&nbsp; &nbsp;alert(<span class="co1">&#8216;I&#8221;m finished !&#8217;);<br />
</span>}</div>
</div>
<p>With VBA, you can&#8217;t assign a function to this property of the object, nor a string, nor anything else.  But it will take an object, any object apparently, and it will call its default property when the readyState change property changes.</p>
<p>That&#8217;s why you need to build the extra class module, to be able to control when the object has changed its status.</p>
<p>You don&#8217;t actually need the class module to make it async, as I said, you could just stick it inside of a Do Loop like</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Do</span> <span class="kw1">While</span> xmlHttpRequest.readyState &lt;&gt; 4<br />
&nbsp; &nbsp;DoEvents<br />
<span class="kw1">Loop</span></div>
</div>
<p>but this is not very async IMO&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Glancy</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-21238</link>
		<dc:creator>Doug Glancy</dc:creator>
		<pubDate>Thu, 12 Oct 2006 01:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-21238</guid>
		<description>&lt;p&gt;Juan Pablo,&lt;/p&gt;
&lt;p&gt;I kind of understand how this works.  Can you do a brief explanation of why wrapping this in a class makes it asynchronous?  Thanks.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Juan Pablo,</p>
<p>I kind of understand how this works.  Can you do a brief explanation of why wrapping this in a class makes it asynchronous?  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Vidas</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/#comment-21235</link>
		<dc:creator>Matt Vidas</dc:creator>
		<pubDate>Wed, 11 Oct 2006 18:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1525#comment-21235</guid>
		<description>&lt;p&gt;Hi Juan,&lt;/p&gt;
&lt;p&gt;I can&#039;t tell you how much I appreciate you posting this! You&#039;ve shown me how to multi-thread via VBA alone.  Incredible to me!  I have a few projects that retrieve/save multiple html files from the net, and now I don&#039;t have to resort to an ActiveX EXE to get them concurrently.  After a couple small changes/additions to your code, I now have a completely working solution for me.  A quick test just downloaded 345 pages in a little over a minute; doing them consecutively would have taken me at least 5 minutes.  I wasn&#039;t sure how to use the code tags here, so I exported and zipped up my modified code to &lt;a href=&quot;http://www.hastalavidas.com/JPGInet.zip&quot; rel=&quot;nofollow&quot;&gt;http://www.hastalavidas.com/JPGInet.zip&lt;/a&gt; should anyone wish to see.&lt;/p&gt;
&lt;p&gt;As a side note for others reading this, don&#039;t forget to add a reference to Microsoft XML.&lt;/p&gt;
&lt;p&gt;Thank you thank you thank you!!&lt;br&gt;
Matt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Juan,</p>
<p>I can&#8217;t tell you how much I appreciate you posting this! You&#8217;ve shown me how to multi-thread via VBA alone.  Incredible to me!  I have a few projects that retrieve/save multiple html files from the net, and now I don&#8217;t have to resort to an ActiveX EXE to get them concurrently.  After a couple small changes/additions to your code, I now have a completely working solution for me.  A quick test just downloaded 345 pages in a little over a minute; doing them consecutively would have taken me at least 5 minutes.  I wasn&#8217;t sure how to use the code tags here, so I exported and zipped up my modified code to <a href="http://www.hastalavidas.com/JPGInet.zip" rel="nofollow">http://www.hastalavidas.com/JPGInet.zip</a> should anyone wish to see.</p>
<p>As a side note for others reading this, don&#8217;t forget to add a reference to Microsoft XML.</p>
<p>Thank you thank you thank you!!<br />
Matt</p>
]]></content:encoded>
	</item>
</channel>
</rss>

