<?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: Code Construction</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/</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: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38442</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Fri, 13 Mar 2009 14:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38442</guid>
		<description>&lt;p&gt;Good point &lt;strong&gt;Jon&lt;/strong&gt;.  I lose nothing by writing it as a function and just calling it as a sub.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bob&lt;/strong&gt;: Yes, DDoE Tools.  I&#039;ve often thought of that.  I use about five things from MZ-Tools and a few of them to almost what I want.  Those five things are important, mind you, but there&#039;s a lot in MZ that I simply don&#039;t use. So I wouldn&#039;t have to replicate everything in MZ for my purposes.  I really hate programming in the VBE though - too much text manipulation.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Good point <strong>Jon</strong>.  I lose nothing by writing it as a function and just calling it as a sub.</p>
<p><strong>Bob</strong>: Yes, DDoE Tools.  I&#8217;ve often thought of that.  I use about five things from MZ-Tools and a few of them to almost what I want.  Those five things are important, mind you, but there&#8217;s a lot in MZ that I simply don&#8217;t use. So I wouldn&#8217;t have to replicate everything in MZ for my purposes.  I really hate programming in the VBE though &#8211; too much text manipulation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38438</link>
		<dc:creator>Ross</dc:creator>
		<pubDate>Fri, 13 Mar 2009 10:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38438</guid>
		<description>&lt;p&gt;@ Jon and Bob,&lt;br&gt;
Sounds like you guys would get on well with F#? It did strike me when I was reading about F#, that well, you could just write all you code as functions in any(most) languages, so why have one that only (not only anyway!) uses functions. &lt;/p&gt;
&lt;p&gt;Now I&#039;m 100% sure that I have totally missed the point, but as I have always said ignorance is no reason for not forming a opinion!&lt;/p&gt;
&lt;p&gt;As always interesting reading, good work Dick! Nice ideas Jon Bob and Alex.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@ Jon and Bob,<br />
Sounds like you guys would get on well with F#? It did strike me when I was reading about F#, that well, you could just write all you code as functions in any(most) languages, so why have one that only (not only anyway!) uses functions. </p>
<p>Now I&#8217;m 100% sure that I have totally missed the point, but as I have always said ignorance is no reason for not forming a opinion!</p>
<p>As always interesting reading, good work Dick! Nice ideas Jon Bob and Alex.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38433</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 13 Mar 2009 02:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38433</guid>
		<description>&lt;p&gt;Dick -&lt;/p&gt;
&lt;p&gt;Like Bob, I tend to make my procedures into functions. If I don&#039;t need the result, I can still call it as a sub and ignore the return value. But somewhere else in the project I may decide I want that return. &lt;/p&gt;
&lt;p&gt;Like you said, it depends.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick -</p>
<p>Like Bob, I tend to make my procedures into functions. If I don&#8217;t need the result, I can still call it as a sub and ignore the return value. But somewhere else in the project I may decide I want that return. </p>
<p>Like you said, it depends.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Phillips</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38430</link>
		<dc:creator>Bob Phillips</dc:creator>
		<pubDate>Thu, 12 Mar 2009 23:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38430</guid>
		<description>&lt;p&gt;On your property code thing, I don&#039;t agree with that, but your style is your style. I am a real pedant, I type my properties from scratch every time. The one that always gets me is a Property Let that takes a parameter, catches me every time.&lt;/p&gt;
&lt;p&gt;Anyway, back to my point. If MZ-Tools won&#039;t format as you want, write a simple VBE procedure yourself and assign it to a toolbar button, DDoE-Tools!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>On your property code thing, I don&#8217;t agree with that, but your style is your style. I am a real pedant, I type my properties from scratch every time. The one that always gets me is a Property Let that takes a parameter, catches me every time.</p>
<p>Anyway, back to my point. If MZ-Tools won&#8217;t format as you want, write a simple VBE procedure yourself and assign it to a toolbar button, DDoE-Tools!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Phillips</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38426</link>
		<dc:creator>Bob Phillips</dc:creator>
		<pubDate>Thu, 12 Mar 2009 23:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38426</guid>
		<description>&lt;p&gt;Dick,&lt;/p&gt;
&lt;p&gt;Seeing as you are listening to me at last, I only use functions, never subs. I was persuaded that every procedure should return a result, even if it is only to signify success or failure. I took the principle on board, but I admit that I prefer my return indicator to a Byref (and last) argument, probably a throwback to use of API calls.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick,</p>
<p>Seeing as you are listening to me at last, I only use functions, never subs. I was persuaded that every procedure should return a result, even if it is only to signify success or failure. I took the principle on board, but I admit that I prefer my return indicator to a Byref (and last) argument, probably a throwback to use of API calls.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38421</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Thu, 12 Mar 2009 16:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38421</guid>
		<description>&lt;p&gt;Scott: Good question.  I suppose I should.&lt;/p&gt;
&lt;p&gt;Jon: I use PED error handling.  But for a procedure surrounded by an On Error Resume Next, it didn&#039;t seem necessary to return anything.  There are some situations where I use On Error Resume Next, that it would make sense to return something, like&lt;/p&gt;
&lt;p&gt;Set wb = GetWorkbook(sWorkbookName)&lt;br&gt;
If Not wb Is Nothing Then&lt;/p&gt;
&lt;p&gt;rather than&lt;/p&gt;
&lt;p&gt;On Error Resume Next&lt;br&gt;
  Set wb = Workbooks(sWorkbookName)&lt;br&gt;
On Error Goto 0&lt;br&gt;
If Not wb Is Nothing&lt;/p&gt;
&lt;p&gt;But for the collection example, I don&#039;t care what happened.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Scott: Good question.  I suppose I should.</p>
<p>Jon: I use PED error handling.  But for a procedure surrounded by an On Error Resume Next, it didn&#8217;t seem necessary to return anything.  There are some situations where I use On Error Resume Next, that it would make sense to return something, like</p>
<p>Set wb = GetWorkbook(sWorkbookName)<br />
If Not wb Is Nothing Then</p>
<p>rather than</p>
<p>On Error Resume Next<br />
  Set wb = Workbooks(sWorkbookName)<br />
On Error Goto 0<br />
If Not wb Is Nothing</p>
<p>But for the collection example, I don&#8217;t care what happened.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AlexJ</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38420</link>
		<dc:creator>AlexJ</dc:creator>
		<pubDate>Thu, 12 Mar 2009 15:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38420</guid>
		<description>&lt;p&gt;Per Jon&#039;s comment, I&#039;ve started using Functions with sting returns. The strings are public variables named like xErrOK (=&quot;OK&quot;), xErr1 = &quot;Error Type 1?, etc. If I hit an error in the function, I return that value to the caller which invokes an error process with messages, etc. (I like to use  If Function1 = xErr1 then Err.Raise(1001) - or something like that.)&lt;/p&gt;
&lt;p&gt;Not in the same class as the approach used in &quot;Professional Excel Development&quot;, but works for me. I can provide clearer explanation if anyone wants.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Per Jon&#8217;s comment, I&#8217;ve started using Functions with sting returns. The strings are public variables named like xErrOK (=&#8221;OK&#8221;), xErr1 = &#8220;Error Type 1?, etc. If I hit an error in the function, I return that value to the caller which invokes an error process with messages, etc. (I like to use  If Function1 = xErr1 then Err.Raise(1001) &#8211; or something like that.)</p>
<p>Not in the same class as the approach used in &#8220;Professional Excel Development&#8221;, but works for me. I can provide clearer explanation if anyone wants.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38419</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Thu, 12 Mar 2009 14:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38419</guid>
		<description>&lt;p&gt;Change&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;Public&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; AddToColl(blah blah)&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;into a function so you can return a boolean to indicate success or a long (i.e., a user defined type) to indicate something useful about what happened within the procedure (the type of error, the type of data, or whatever).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Change</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Public</span> <span class="kw1">Sub</span> AddToColl(blah blah)</div>
</div>
<p>into a function so you can return a boolean to indicate success or a long (i.e., a user defined type) to indicate something useful about what happened within the procedure (the type of error, the type of data, or whatever).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38418</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Thu, 12 Mar 2009 12:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38418</guid>
		<description>&lt;p&gt;So, as you start to change your coding techniques, are you going to change your VBA Framework application to match...?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>So, as you start to change your coding techniques, are you going to change your VBA Framework application to match&#8230;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Petr Santarius</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/03/11/code-construction/#comment-38416</link>
		<dc:creator>Petr Santarius</dc:creator>
		<pubDate>Thu, 12 Mar 2009 07:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2227#comment-38416</guid>
		<description>&lt;p&gt;To make your code compact but readable you can write it like this (add spaces):&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;Public&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Property&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Get&lt;/span&gt; Path() &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;: &#160; &#160; &#160; &#160; &#160; &#160; &#160;Path = msPath: &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Property&lt;/span&gt;&lt;/div&gt;&lt;/div&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;Public&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Property&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Let&lt;/span&gt; Path(&lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; sPath &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;): &#160; msPath = sPath: &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Property&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The same works with Dim and Const statements&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;Dim&lt;/span&gt; intSize &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;&lt;/div&gt;&lt;/div&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;Dim&lt;/span&gt; dblBigBoss &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Petr&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>To make your code compact but readable you can write it like this (add spaces):</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Public</span> <span class="kw1">Property</span> <span class="kw1">Get</span> Path() <span class="kw1">As</span> <span class="kw1">String</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Path = msPath: &nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">Property</span></div>
</div>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Public</span> <span class="kw1">Property</span> <span class="kw1">Let</span> Path(<span class="kw1">ByVal</span> sPath <span class="kw1">As</span> <span class="kw1">String</span>): &nbsp; msPath = sPath: &nbsp; <span class="kw1">End</span> <span class="kw1">Property</span></div>
</div>
<p>The same works with Dim and Const statements</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Dim</span> intSize &nbsp; &nbsp;<span class="kw1">As</span> <span class="kw1">Integer</span></div>
</div>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Dim</span> dblBigBoss <span class="kw1">As</span> <span class="kw1">String</span></div>
</div>
<p>Petr</p>
]]></content:encoded>
	</item>
</channel>
</rss>

