<?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: ExtractPath</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2004/05/26/extractpath/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2004/05/26/extractpath/</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: SGershon</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/05/26/extractpath/#comment-1603</link>
		<dc:creator>SGershon</dc:creator>
		<pubDate>Sun, 19 Sep 2004 08:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=579#comment-1603</guid>
		<description>&lt;p&gt;Thanks!&lt;br&gt;
Saved me a lot of time!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks!<br />
Saved me a lot of time!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/05/26/extractpath/#comment-1602</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Fri, 28 May 2004 22:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=579#comment-1602</guid>
		<description>&lt;p&gt;It&#039;s not too long winded, I&#039;ve seen much worse. At least you didn&#039;t use the Split() function, while being novel, is slow &amp; memory hungry (and doesn&#039;t handle A:File.dat either).&lt;/p&gt;
&lt;p&gt;I can&#039;t remember what the UNC problem was, brain failure on my part probably.&lt;/p&gt;
&lt;p&gt;Many of my functions for this type of thing were written many years ago, in my version I wrote my own InstrRev(). That was part of what I meant by long winded. You end up with functions calling functions calling functions... but each function is quite small and readable. Test &amp; forget. For example, my credit card check digit routine dates from 1985!&lt;/p&gt;
&lt;p&gt;One thing you shouldn&#039;t do (even though it works) is this line mixing boolean &amp; maths:&lt;/p&gt;
&lt;p&gt;    lInclLast = CLng(bIncludeLast) + 1&lt;/p&gt;
&lt;p&gt;bIncludeLast is a Boolean, which isn&#039;t really a number. By that I mean it&#039;s either True or False, with no guarantee of what their actual values are. VB.Net would have changed the value of True from -1 to 1, but too many people with dodgy code complained!&lt;/p&gt;
&lt;p&gt;Many large companies still use Office97, so you still need to consider that.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>It&#8217;s not too long winded, I&#8217;ve seen much worse. At least you didn&#8217;t use the Split() function, while being novel, is slow &amp; memory hungry (and doesn&#8217;t handle A:File.dat either).</p>
<p>I can&#8217;t remember what the UNC problem was, brain failure on my part probably.</p>
<p>Many of my functions for this type of thing were written many years ago, in my version I wrote my own InstrRev(). That was part of what I meant by long winded. You end up with functions calling functions calling functions&#8230; but each function is quite small and readable. Test &amp; forget. For example, my credit card check digit routine dates from 1985!</p>
<p>One thing you shouldn&#8217;t do (even though it works) is this line mixing boolean &amp; maths:</p>
<p>    lInclLast = CLng(bIncludeLast) + 1</p>
<p>bIncludeLast is a Boolean, which isn&#8217;t really a number. By that I mean it&#8217;s either True or False, with no guarantee of what their actual values are. VB.Net would have changed the value of True from -1 to 1, but too many people with dodgy code complained!</p>
<p>Many large companies still use Office97, so you still need to consider that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/05/26/extractpath/#comment-1601</link>
		<dc:creator>Dick</dc:creator>
		<pubDate>Thu, 27 May 2004 16:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=579#comment-1601</guid>
		<description>&lt;p&gt;&quot;A bit long winded&quot;&lt;/p&gt;
&lt;p&gt;Not the first time I&#039;ve been accused of that.  I don&#039;t write functions (or try not to, at least) that don&#039;t work in 97.  A lot of people still use it, including everyone in my office except me.  I&#039;m considering dropping 97 support when the next version comes out, but I haven&#039;t decided yet.&lt;/p&gt;
&lt;p&gt;&quot;A:File.dat&quot;&lt;/p&gt;
&lt;p&gt;I think I better fix it for that.&lt;/p&gt;
&lt;p&gt;&quot;when it should return a blank&quot;&lt;/p&gt;
&lt;p&gt;I designed it that, but I can&#039;t remember why.  It must have been a particular situation.  But I agree, it should return an empty string.&lt;/p&gt;
&lt;p&gt;&quot;Then there&#039;s UNC names (network)...&quot;&lt;/p&gt;
&lt;p&gt;It works for me on UNC paths.  Mine are like Servier1FolderFile.xls which it handles okay.  Is there something I&#039;m missing?&lt;/p&gt;
&lt;p&gt;Thanks for the comments.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;A bit long winded&#8221;</p>
<p>Not the first time I&#8217;ve been accused of that.  I don&#8217;t write functions (or try not to, at least) that don&#8217;t work in 97.  A lot of people still use it, including everyone in my office except me.  I&#8217;m considering dropping 97 support when the next version comes out, but I haven&#8217;t decided yet.</p>
<p>&#8220;A:File.dat&#8221;</p>
<p>I think I better fix it for that.</p>
<p>&#8220;when it should return a blank&#8221;</p>
<p>I designed it that, but I can&#8217;t remember why.  It must have been a particular situation.  But I agree, it should return an empty string.</p>
<p>&#8220;Then there&#8217;s UNC names (network)&#8230;&#8221;</p>
<p>It works for me on UNC paths.  Mine are like Servier1FolderFile.xls which it handles okay.  Is there something I&#8217;m missing?</p>
<p>Thanks for the comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/05/26/extractpath/#comment-1600</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Thu, 27 May 2004 02:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=579#comment-1600</guid>
		<description>&lt;p&gt;A bit long winded, plus a couple of bugs....&lt;/p&gt;
&lt;p&gt;The quick &amp; dirty function is:&lt;/p&gt;
&lt;p&gt;Function ExtractPath(sFullPath As String) As String&lt;br&gt;
    ExtractPath = Left$(sFullPath, InStrRev(sFullPath, &quot;&quot;))&lt;br&gt;
End Function&lt;/p&gt;
&lt;p&gt;Won&#039;t work in XL97 due to the InstrRev function, which is in VBA6.  Needs XL2000+.&lt;/p&gt;
&lt;p&gt;This one matches the functionality of the original:&lt;/p&gt;
&lt;p&gt;Function ExtractPath(sFullPath As String, Optional bIncludeLast As Boolean = True) As String&lt;/p&gt;
&lt;p&gt;    Dim lSepPos As Long&lt;br&gt;
    Const sPATHSEP As String = &quot;&quot;&lt;/p&gt;
&lt;p&gt;    lSepPos = InStrRev(sFullPath, sPATHSEP)&lt;br&gt;
    If lSepPos &gt; 0 Then&lt;br&gt;
        If bIncludeLast = False Then&lt;br&gt;
            lSepPos = lSepPos - 1&lt;br&gt;
        End If&lt;br&gt;
        ExtractPath = Left$(sFullPath, lSepPos)&lt;br&gt;
    End If&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;p&gt;All of these function fail with something like sFullPath = &quot;A:File.dat&quot;.  This is a valid filename, even with the &quot;&quot; missing.&lt;/p&gt;
&lt;p&gt;For a filename like &quot;File.dat&quot; which does not contain a path, the original returns the passed filename, when it should return a blank.&lt;/p&gt;
&lt;p&gt;Then there&#039;s UNC names (network)...&lt;/p&gt;
&lt;p&gt;Tony&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>A bit long winded, plus a couple of bugs&#8230;.</p>
<p>The quick &amp; dirty function is:</p>
<p>Function ExtractPath(sFullPath As String) As String<br />
    ExtractPath = Left$(sFullPath, InStrRev(sFullPath, &#8220;&#8221;))<br />
End Function</p>
<p>Won&#8217;t work in XL97 due to the InstrRev function, which is in VBA6.  Needs XL2000+.</p>
<p>This one matches the functionality of the original:</p>
<p>Function ExtractPath(sFullPath As String, Optional bIncludeLast As Boolean = True) As String</p>
<p>    Dim lSepPos As Long<br />
    Const sPATHSEP As String = &#8220;&#8221;</p>
<p>    lSepPos = InStrRev(sFullPath, sPATHSEP)<br />
    If lSepPos &gt; 0 Then<br />
        If bIncludeLast = False Then<br />
            lSepPos = lSepPos &#8211; 1<br />
        End If<br />
        ExtractPath = Left$(sFullPath, lSepPos)<br />
    End If</p>
<p>End Function</p>
<p>All of these function fail with something like sFullPath = &#8220;A:File.dat&#8221;.  This is a valid filename, even with the &#8220;&#8221; missing.</p>
<p>For a filename like &#8220;File.dat&#8221; which does not contain a path, the original returns the passed filename, when it should return a blank.</p>
<p>Then there&#8217;s UNC names (network)&#8230;</p>
<p>Tony</p>
]]></content:encoded>
	</item>
</channel>
</rss>

