<?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: Giving IE the Focus</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: VeVi</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/#comment-38720</link>
		<dc:creator>VeVi</dc:creator>
		<pubDate>Mon, 30 Mar 2009 13:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1847#comment-38720</guid>
		<description>&lt;p&gt;HI,&lt;/p&gt;
&lt;p&gt;I wanted to learn automation IE apps through EXcel.&lt;/p&gt;
&lt;p&gt;below is one of the code that i saw in this site.&lt;br&gt;
but, it doesnt work.&lt;/p&gt;
&lt;p&gt;it throws an error &quot;User-defined type not defined&quot;&lt;/p&gt;
&lt;p&gt;however, please provide good way to learn automating webapps.&lt;br&gt;
Regarding, the references none of them are in my PC version Excel2007.&lt;/p&gt;
&lt;p&gt;have to be download separately.?&lt;/p&gt;
&lt;p&gt; Dim IeApp As InternetExplorer&lt;br&gt;
    Dim sURL As String&lt;br&gt;
    Dim IeDoc As Object&lt;br&gt;
    Dim i As Long&lt;/p&gt;
&lt;p&gt;    &#039;Create new instance of IE&lt;br&gt;
    Set IeApp = New InternetExplorer&lt;/p&gt;
&lt;p&gt;    &#039;Make it visible - some things don&#039;t work&lt;br&gt;
    &#039;unless it&#039;s visible&lt;br&gt;
    IeApp.Visible = True&lt;/p&gt;
&lt;p&gt;    &#039;define the page to open&lt;br&gt;
    sURL = &quot;www.dicks - blog.com&quot;&lt;/p&gt;
&lt;p&gt;    &#039;navigate to the page&lt;br&gt;
    IeApp.Navigate sURL&lt;/p&gt;
&lt;p&gt;    &#039;Pause the macro using a loop until the&lt;br&gt;
    &#039;page is fully loaded&lt;br&gt;
    Do&lt;br&gt;
    Loop Until IeApp.ReadyState = READYSTATE_COMPLETE&lt;/p&gt;
&lt;p&gt;    &#039;store the Document object&lt;br&gt;
    Set IeDoc = IeApp.Document&lt;/p&gt;
&lt;p&gt;    &#039;Loop through the links collection.  Most collections&lt;br&gt;
    &#039;seem to be zero based, but it&#039;s pretty much trial and&lt;br&gt;
    &#039;error for me&lt;br&gt;
    For i = 0 To IeDoc.Links.Length - 1&lt;br&gt;
        &#039;write the linking url to a cell&lt;br&gt;
        Cells(i + 1, 1).Value = IeDoc.Links(i).href&lt;br&gt;
    Next i&lt;/p&gt;
&lt;p&gt;    &#039;Clean up&lt;br&gt;
    Set IeApp = Nothing&lt;/p&gt;
&lt;p&gt;Thankss,&lt;br&gt;
Venkat&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>HI,</p>
<p>I wanted to learn automation IE apps through EXcel.</p>
<p>below is one of the code that i saw in this site.<br />
but, it doesnt work.</p>
<p>it throws an error &#8220;User-defined type not defined&#8221;</p>
<p>however, please provide good way to learn automating webapps.<br />
Regarding, the references none of them are in my PC version Excel2007.</p>
<p>have to be download separately.?</p>
<p> Dim IeApp As InternetExplorer<br />
    Dim sURL As String<br />
    Dim IeDoc As Object<br />
    Dim i As Long</p>
<p>    &#8216;Create new instance of IE<br />
    Set IeApp = New InternetExplorer</p>
<p>    &#8216;Make it visible &#8211; some things don&#8217;t work<br />
    &#8216;unless it&#8217;s visible<br />
    IeApp.Visible = True</p>
<p>    &#8216;define the page to open<br />
    sURL = &#8220;www.dicks &#8211; blog.com&#8221;</p>
<p>    &#8216;navigate to the page<br />
    IeApp.Navigate sURL</p>
<p>    &#8216;Pause the macro using a loop until the<br />
    &#8216;page is fully loaded<br />
    Do<br />
    Loop Until IeApp.ReadyState = READYSTATE_COMPLETE</p>
<p>    &#8216;store the Document object<br />
    Set IeDoc = IeApp.Document</p>
<p>    &#8216;Loop through the links collection.  Most collections<br />
    &#8216;seem to be zero based, but it&#8217;s pretty much trial and<br />
    &#8216;error for me<br />
    For i = 0 To IeDoc.Links.Length &#8211; 1<br />
        &#8216;write the linking url to a cell<br />
        Cells(i + 1, 1).Value = IeDoc.Links(i).href<br />
    Next i</p>
<p>    &#8216;Clean up<br />
    Set IeApp = Nothing</p>
<p>Thankss,<br />
Venkat</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/#comment-32615</link>
		<dc:creator>JP</dc:creator>
		<pubDate>Sat, 31 May 2008 14:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1847#comment-32615</guid>
		<description>&lt;p&gt;There&#039;s a section in the book &quot;Professional Excel Development&quot; called &quot;Working With Windows&quot; that uses some pretty complicated API calls with multiple instances of Excel to determine which is the correct one to use. Perhaps it could be altered to work with IE.&lt;/p&gt;
&lt;p&gt;I like David&#039;s code, I do some work with IE occasionally so I&#039;ll test it out.&lt;/p&gt;
&lt;p&gt;Thx,&lt;br&gt;
JP&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>There&#8217;s a section in the book &#8220;Professional Excel Development&#8221; called &#8220;Working With Windows&#8221; that uses some pretty complicated API calls with multiple instances of Excel to determine which is the correct one to use. Perhaps it could be altered to work with IE.</p>
<p>I like David&#8217;s code, I do some work with IE occasionally so I&#8217;ll test it out.</p>
<p>Thx,<br />
JP</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lance</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/#comment-32604</link>
		<dc:creator>lance</dc:creator>
		<pubDate>Fri, 30 May 2008 23:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1847#comment-32604</guid>
		<description>&lt;p&gt;so is there a way to do this with Firefox?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>so is there a way to do this with Firefox?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hui...</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/#comment-32581</link>
		<dc:creator>Hui...</dc:creator>
		<pubDate>Thu, 29 May 2008 00:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1847#comment-32581</guid>
		<description>&lt;p&gt;Spot on Dick&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Spot on Dick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/#comment-32578</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Wed, 28 May 2008 21:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1847#comment-32578</guid>
		<description>&lt;p&gt;I think Hui meant why would anyone use IE with so many better browsers available.  At least that&#039;s how I took it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I think Hui meant why would anyone use IE with so many better browsers available.  At least that&#8217;s how I took it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/#comment-32577</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 28 May 2008 21:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1847#comment-32577</guid>
		<description>&lt;p&gt;Hui, &lt;/p&gt;
&lt;p&gt;I use this method quite often.  Not as he used it giving IE the focus.  &lt;/p&gt;
&lt;p&gt;I created a function called GetIE that grabs a Website if already open and returns the IE object, or creates a new IE object.&lt;/p&gt;
&lt;p&gt;Pretty useful in my opinion.&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; GetIE(&lt;span class=&quot;kw1&quot;&gt;Optional&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; sWindowTitle &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt; = vbNullString) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Object&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; oShellWin &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; SHDocVw.ShellWindows, _&lt;br&gt;
&#160; &#160; &#160; &#160; oWin &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Object&lt;/span&gt;, _&lt;br&gt;
&#160; &#160; &#160; &#160; ieRunning &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &#160; ieRunning = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; oShellWin = &lt;span class=&quot;kw1&quot;&gt;New&lt;/span&gt; SHDocVw.ShellWindows&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; oShellWin.Count &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; oWin &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; oShellWin&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; sWindowTitle &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; vbNullString &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; oWin.LocationName &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; &amp; sWindowTitle &amp; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ieRunning = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; GetIE = oWin&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Else&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; oWin.Name &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;Microsoft Internet Explorer&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ieRunning = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; GetIE = oWin&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; oWin&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; ieRunning = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; GetIE = CreateObject(&lt;span class=&quot;st0&quot;&gt;&quot;InternetExplorer.Application&quot;&lt;/span&gt;)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; objSW = &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>Hui, </p>
<p>I use this method quite often.  Not as he used it giving IE the focus.  </p>
<p>I created a function called GetIE that grabs a Website if already open and returns the IE object, or creates a new IE object.</p>
<p>Pretty useful in my opinion.</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> GetIE(<span class="kw1">Optional</span> <span class="kw1">ByVal</span> sWindowTitle <span class="kw1">As</span> <span class="kw1">String</span> = vbNullString) <span class="kw1">As</span> <span class="kw1">Object</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> oShellWin <span class="kw1">As</span> SHDocVw.ShellWindows, _<br />
&nbsp; &nbsp; &nbsp; &nbsp; oWin <span class="kw1">As</span> <span class="kw1">Object</span>, _<br />
&nbsp; &nbsp; &nbsp; &nbsp; ieRunning <span class="kw1">As</span> <span class="kw1">Boolean</span></p>
<p>&nbsp; &nbsp; ieRunning = <span class="kw1">False</span><br />
&nbsp; &nbsp; <span class="kw1">Set</span> oShellWin = <span class="kw1">New</span> SHDocVw.ShellWindows<br />
&nbsp; &nbsp; <span class="kw1">If</span> oShellWin.Count <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">For</span> <span class="kw1">Each</span> oWin <span class="kw1">In</span> oShellWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> sWindowTitle <span class="kw1">Like</span> vbNullString <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> oWin.LocationName <span class="kw1">Like</span> <span class="st0">&#8220;*&#8221;</span> &amp;amp; sWindowTitle &amp;amp; <span class="st0">&#8220;*&#8221;</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ieRunning = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Set</span> GetIE = oWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Exit</span> <span class="kw1">For</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> oWin.Name <span class="kw1">Like</span> <span class="st0">&#8220;Microsoft Internet Explorer&#8221;</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ieRunning = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Set</span> GetIE = oWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Exit</span> <span class="kw1">For</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Next</span> oWin<br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">If</span> ieRunning = <span class="kw1">False</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Set</span> GetIE = CreateObject(<span class="st0">&#8220;InternetExplorer.Application&#8221;</span>)<br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">Set</span> objSW = <span class="kw1">Nothing</span><br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hui...</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/05/23/giving-ie-the-focus/#comment-32572</link>
		<dc:creator>Hui...</dc:creator>
		<pubDate>Wed, 28 May 2008 13:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1847#comment-32572</guid>
		<description>&lt;p&gt;This may be more suited to Slashdot comment, but why would you want to give Internet Explorer the focus at all ?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This may be more suited to Slashdot comment, but why would you want to give Internet Explorer the focus at all ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

