<?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: Create a QueryTable from an Excel Source in VBA</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 18:06:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: doomsday</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/#comment-60296</link>
		<dc:creator>doomsday</dc:creator>
		<pubDate>Fri, 04 Mar 2011 02:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1857#comment-60296</guid>
		<description>&lt;p&gt;yes good point with code blocks using QueryTables and CommandText is the way to use native Excel , without using addins..&lt;br&gt;
If you try&lt;br&gt;
Dim rst as ADODB.Recordset&lt;br&gt;
you will get a user-defined type not defined error. Thus, where portability to other Excel users is necessary, this method of using querytables seems to be ideal.&lt;/p&gt;
&lt;p&gt;However, the real-time status of the query update is shown in the globe in the taskbar.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>yes good point with code blocks using QueryTables and CommandText is the way to use native Excel , without using addins..<br />
If you try<br />
Dim rst as ADODB.Recordset<br />
you will get a user-defined type not defined error. Thus, where portability to other Excel users is necessary, this method of using querytables seems to be ideal.</p>
<p>However, the real-time status of the query update is shown in the globe in the taskbar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dale</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/#comment-55402</link>
		<dc:creator>Dale</dc:creator>
		<pubDate>Sat, 04 Dec 2010 13:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1857#comment-55402</guid>
		<description>&lt;p&gt;It&#039;s a little complicated, so I&#039;ll give the readers digest version.&lt;br&gt;
I&#039;m building a spreadsheet to compare current and prior year and graph it by week, month and quarter using index and match. I can insert saved queries at different locations in target, but I have to edit 26 queries (13 weeks each for prior and current year) for each branch in the region and it&#039;s quite time consuming. Is there a way to run code in vba to execute all these at once, then I can just use replace to change branch numbers and run in a new spread sheet for each location?&lt;br&gt;
Here is a sample query for week 1 in 2010, the week numbers are all that change (Wk 1 to Wk 2 and Week1 to Week2, etc) for each query.&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container text default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;text codecolorer&quot;&gt;XLODBC&lt;br&gt;
&lt;br&gt;
1&lt;br&gt;
&lt;br&gt;
DSN=Excel Files;DBQ=R:2010P1Wk 1Supplemental2066_Week1ToDateProductionSales.xls;DefaultDir=R:2010P1Wk 1Supplemental;DriverId=790;MaxBufferSize=2048;PageTimeout=5;&lt;br&gt;
&lt;br&gt;
SELECT &#039;Sheet1$&#039;.&#039;Daily Production/Sales by Category and PricePoint Unified&#039;, &#039;Sheet1$&#039;.F2, &#039;Sheet1$&#039;.F9 &#160;FROM &#039;R:2010P1Wk 1Supplemental2066_Week1ToDateProductionSales&#039;.&#039;Sheet1$&#039; &#039;Sheet1$&#039; &#160;WHERE (&#039;Sheet1$&#039;.F2 Is Null) OR (&#039;Sheet1$&#039;.F2 Like &#039;Total&#039;) OR (&#039;Sheet1$&#039;.F2 Like &#039;Branch Total&#039;)&lt;br&gt;
&lt;br&gt;
&#160;&lt;br&gt;
&lt;br&gt;
&#160;&lt;br&gt;
&lt;br&gt;
Daily Production/Sales by Category and PricePoint Unified &#160; F2 &#160; &#160;F9&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Secondly, as 2011p1 doesn&#039;t exist yet, is there a way to have the query return blank when the query fails due to &quot;file does not exist&#039; without freezing?&lt;/p&gt;
&lt;p&gt;Lastly, I believe the branch systems are still using 2000 or 2003. I.T. is updating all the corp and field computers, but unfortunately all us grunts at the branches where all the real work gets done are at the bottom of the list.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>It&#8217;s a little complicated, so I&#8217;ll give the readers digest version.<br />
I&#8217;m building a spreadsheet to compare current and prior year and graph it by week, month and quarter using index and match. I can insert saved queries at different locations in target, but I have to edit 26 queries (13 weeks each for prior and current year) for each branch in the region and it&#8217;s quite time consuming. Is there a way to run code in vba to execute all these at once, then I can just use replace to change branch numbers and run in a new spread sheet for each location?<br />
Here is a sample query for week 1 in 2010, the week numbers are all that change (Wk 1 to Wk 2 and Week1 to Week2, etc) for each query.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container text default">
<div style="white-space: nowrap;" class="text codecolorer">XLODBC</p>
<p>1</p>
<p>DSN=Excel Files;DBQ=R:2010P1Wk 1Supplemental2066_Week1ToDateProductionSales.xls;DefaultDir=R:2010P1Wk 1Supplemental;DriverId=790;MaxBufferSize=2048;PageTimeout=5;</p>
<p>SELECT &#8216;Sheet1$&#8217;.'Daily Production/Sales by Category and PricePoint Unified&#8217;, &#8216;Sheet1$&#8217;.F2, &#8216;Sheet1$&#8217;.F9 &nbsp;FROM &#8216;R:2010P1Wk 1Supplemental2066_Week1ToDateProductionSales&#8217;.'Sheet1$&#8217; &#8216;Sheet1$&#8217; &nbsp;WHERE (&#8216;Sheet1$&#8217;.F2 Is Null) OR (&#8216;Sheet1$&#8217;.F2 Like &#8216;Total&#8217;) OR (&#8216;Sheet1$&#8217;.F2 Like &#8216;Branch Total&#8217;)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Daily Production/Sales by Category and PricePoint Unified &nbsp; F2 &nbsp; &nbsp;F9</p></div>
</div>
<p>Secondly, as 2011p1 doesn&#8217;t exist yet, is there a way to have the query return blank when the query fails due to &#8220;file does not exist&#8217; without freezing?</p>
<p>Lastly, I believe the branch systems are still using 2000 or 2003. I.T. is updating all the corp and field computers, but unfortunately all us grunts at the branches where all the real work gets done are at the bottom of the list.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/#comment-33457</link>
		<dc:creator>Jan</dc:creator>
		<pubDate>Mon, 07 Jul 2008 21:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1857#comment-33457</guid>
		<description>&lt;p&gt;I have had some really bad type issues with this particularly where there is no data in the first 8 or even 16 rows of a column.  The Excel / Jet engine type casting gets it wholly wrong and screws up all sorts of queries.  Rule of thumb be careful and don&#039;t use this on any data that might have gaps in it.&lt;br&gt;
No amount of tweaking was able to deal with this problem even trying casting of data using multipliers unions with hard coded numbers etc.  All failed and sometimes I would even get a whole column from something that was not in the select statement.  This was not down to some bad SQL this was a purely random impact based on large datasets.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have had some really bad type issues with this particularly where there is no data in the first 8 or even 16 rows of a column.  The Excel / Jet engine type casting gets it wholly wrong and screws up all sorts of queries.  Rule of thumb be careful and don&#8217;t use this on any data that might have gaps in it.<br />
No amount of tweaking was able to deal with this problem even trying casting of data using multipliers unions with hard coded numbers etc.  All failed and sometimes I would even get a whole column from something that was not in the select statement.  This was not down to some bad SQL this was a purely random impact based on large datasets.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob van Gelder</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/#comment-33112</link>
		<dc:creator>Rob van Gelder</dc:creator>
		<pubDate>Wed, 25 Jun 2008 10:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1857#comment-33112</guid>
		<description>&lt;p&gt;Something very interesting that I didn&#039;t notice before.&lt;br&gt;
You can create a querytable in the same workbook, and it the data refreshed without first having to save it.&lt;/p&gt;
&lt;p&gt;Triggering the refresh is a minor issue&lt;br&gt;
Lists that grow based on selectable criteria (parameter query) is a very useful feature.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Something very interesting that I didn&#8217;t notice before.<br />
You can create a querytable in the same workbook, and it the data refreshed without first having to save it.</p>
<p>Triggering the refresh is a minor issue<br />
Lists that grow based on selectable criteria (parameter query) is a very useful feature.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans Schraven</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/#comment-33110</link>
		<dc:creator>Hans Schraven</dc:creator>
		<pubDate>Wed, 25 Jun 2008 10:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1857#comment-33110</guid>
		<description>&lt;p&gt;Some more reducement&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;Sub&lt;/span&gt; idee()&lt;br&gt;
&#160; ActiveWorkbook.Sheets.Add&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt; ActiveSheet.QueryTables.Add(&lt;span class=&quot;st0&quot;&gt;&quot;ODBC;DSN=Excel-bestanden;DBQ=E:TheDatabook.xls&quot;&lt;/span&gt;,[H1])&lt;br&gt;
&#160; &#160; .CommandText = &lt;span class=&quot;st0&quot;&gt;&quot;SELECT name, number FROM TheData WHERE number =1&quot;&lt;/span&gt;&lt;br&gt;
&#160; &#160; .Refresh &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>Some more reducement</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> idee()<br />
&nbsp; ActiveWorkbook.Sheets.Add<br />
&nbsp; <span class="kw1">With</span> ActiveSheet.QueryTables.Add(<span class="st0">&#8220;ODBC;DSN=Excel-bestanden;DBQ=E:TheDatabook.xls&#8221;</span>,[H1])<br />
&nbsp; &nbsp; .CommandText = <span class="st0">&#8220;SELECT name, number FROM TheData WHERE number =1&#8243;</span><br />
&nbsp; &nbsp; .Refresh <span class="kw1">False</span><br />
&nbsp; <span class="kw1">End</span> <span class="kw1">With</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans Schraven</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/06/24/create-a-querytable-from-an-excel-source-in-vba/#comment-33109</link>
		<dc:creator>Hans Schraven</dc:creator>
		<pubDate>Wed, 25 Jun 2008 09:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1857#comment-33109</guid>
		<description>&lt;p&gt;Wouldn&#039;t it be nice to clean up the connectionstring as well ?&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;Sub&lt;/span&gt; idee()&lt;br&gt;
&#160; ActiveWorkbook.Sheets.Add&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt; ActiveSheet.QueryTables.Add(&lt;span class=&quot;st0&quot;&gt;&quot;ODBC;DSN=Excel-bestanden;DBQ=E:TheDatabook.xls;&quot;&lt;/span&gt;, Range(&lt;span class=&quot;st0&quot;&gt;&quot;H1&quot;&lt;/span&gt;))&lt;br&gt;
&#160; &#160; .CommandText = &lt;span class=&quot;st0&quot;&gt;&quot;SELECT name, number FROM E:TheDatabook.TheData TheData WHERE number = 1&quot;&lt;/span&gt;&lt;br&gt;
&#160; &#160; .Refresh &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t it be nice to clean up the connectionstring as well ?</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> idee()<br />
&nbsp; ActiveWorkbook.Sheets.Add<br />
&nbsp; <span class="kw1">With</span> ActiveSheet.QueryTables.Add(<span class="st0">&#8220;ODBC;DSN=Excel-bestanden;DBQ=E:TheDatabook.xls;&#8221;</span>, Range(<span class="st0">&#8220;H1&#8243;</span>))<br />
&nbsp; &nbsp; .CommandText = <span class="st0">&#8220;SELECT name, number FROM E:TheDatabook.TheData TheData WHERE number = 1&#8243;</span><br />
&nbsp; &nbsp; .Refresh <span class="kw1">False</span><br />
&nbsp; <span class="kw1">End</span> <span class="kw1">With</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
</channel>
</rss>

