<?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: Creating Folders with MkDir</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/</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: Error 91 when using excel automation</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/#comment-50833</link>
		<dc:creator>Error 91 when using excel automation</dc:creator>
		<pubDate>Fri, 17 Sep 2010 23:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1419#comment-50833</guid>
		<description>&lt;p&gt;[...] = Nothing End Sub Sub CheckAndCreateFolders(sFolderPath As String) &#039; 14/11/2008, sourced from: _ Daily Dose of Excel » Blog Archive » Creating Folders With MkDir Dim sSubFolder As String Dim sBaseFolder As String Dim sTemp As String Dim ArryDir Dim i As Long If [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] = Nothing End Sub Sub CheckAndCreateFolders(sFolderPath As String) &#8216; 14/11/2008, sourced from: _ Daily Dose of Excel » Blog Archive » Creating Folders With MkDir Dim sSubFolder As String Dim sBaseFolder As String Dim sTemp As String Dim ArryDir Dim i As Long If [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A. van der Goot</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/#comment-31440</link>
		<dc:creator>A. van der Goot</dc:creator>
		<pubDate>Mon, 24 Mar 2008 13:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1419#comment-31440</guid>
		<description>&lt;p&gt;I want make a MkDir with variabele name of dir.&lt;br&gt;
How can I make it in Excel vba.&lt;br&gt;
And I will make a folder in Excel vba.&lt;/p&gt;
&lt;p&gt;I com from Dutch my englisch is not zo good.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I want make a MkDir with variabele name of dir.<br />
How can I make it in Excel vba.<br />
And I will make a folder in Excel vba.</p>
<p>I com from Dutch my englisch is not zo good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/#comment-22541</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Tue, 20 Feb 2007 05:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1419#comment-22541</guid>
		<description>&lt;p&gt;Change: Existance to &quot;non-existance&quot;&lt;/p&gt;
&lt;p&gt;&#039;will give a false indication of the&lt;br&gt;
&#039; folder non-existance. To be sure to detect a directory...&lt;/p&gt;
&lt;p&gt;Change: -2 to -1 in For Next&lt;br&gt;
For i = 0 To UBound(ArryDir) - 1&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Change: Existance to &#8220;non-existance&#8221;</p>
<p>&#8216;will give a false indication of the<br />
&#8216; folder non-existance. To be sure to detect a directory&#8230;</p>
<p>Change: -2 to -1 in For Next<br />
For i = 0 To UBound(ArryDir) &#8211; 1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/#comment-22540</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Tue, 20 Feb 2007 04:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1419#comment-22540</guid>
		<description>&lt;p&gt;&#039; The first line of this snippet should use the vbDirectory parameter ohterwise if a folder does&lt;br&gt;
&#039; not contain any files it will not return a string value and will give a false indication of the&lt;br&gt;
&#039; folder existance. To be sure to detect a directory...&lt;br&gt;
&#039; Use this: If Len(Dir(sBaseFolder &amp; sTemp, vbDirectory)) = 0 Then&lt;br&gt;
&#039; Or this: If Len(Dir(sBaseFolder &amp; sTemp, 16)) = 0 Then&lt;/p&gt;
&lt;p&gt;&#039; This will not detect a directory unless it contains a file.&lt;/p&gt;
&lt;p&gt;        If Len(Dir(sBaseFolder &amp; sTemp)) = 0 Then&lt;br&gt;
            &#039;Use MkDir to create the folder&lt;br&gt;
            MkDir sBaseFolder &amp; sTemp&lt;br&gt;
        End If&lt;/p&gt;
&lt;p&gt;&#039; I adapted the Procedure to create multiple new directories if not existing&lt;br&gt;
&#039; It uses a loop to check each directory and create it if not existing.&lt;/p&gt;
&lt;p&gt;Sub CreateFolders(sFolderPath As String)&lt;br&gt;
    Dim sSubFolder As String&lt;br&gt;
    Dim sBaseFolder As String&lt;br&gt;
    Dim sTemp As String&lt;/p&gt;
&lt;p&gt;    ArryDir = Split(sFolderPath, &quot;&quot;)&lt;/p&gt;
&lt;p&gt;    For i = 0 To UBound(ArryDir) - 2&lt;br&gt;
      sBaseFolder = sBaseFolder &amp; ArryDir(i)&lt;br&gt;
      sSubFolder = ArryDir(i + 1)&lt;br&gt;
      &#039;Make sure the base folder is ready to have a sub folder&lt;br&gt;
      &#039;tacked on to the end&lt;br&gt;
      If Right(sBaseFolder, 1)  &quot;&quot; Then&lt;br&gt;
          sBaseFolder = sBaseFolder &amp; &quot;&quot;&lt;br&gt;
      End If&lt;/p&gt;
&lt;p&gt;      &#039;Make sure base folder exists&lt;br&gt;
      If Len(Dir(sBaseFolder, vbDirectory)) &gt; 0 Then&lt;br&gt;
          &#039;Replace illegal characters with an underscore&lt;br&gt;
          sTemp = CleanFolderName(sSubFolder)&lt;br&gt;
          &#039;See if already exists: Thanks Dave W.&lt;br&gt;
          If Len(Dir(sBaseFolder &amp; sTemp, vbDirectory)) = 0 Then&lt;br&gt;
              &#039;Use MkDir to create the folder&lt;br&gt;
              MkDir sBaseFolder &amp; sTemp&lt;br&gt;
          End If&lt;br&gt;
      End If&lt;br&gt;
    Next&lt;br&gt;
End Sub&lt;/p&gt;
&lt;p&gt;Private Function CleanFolderName(ByVal sFolderName As String) As String&lt;/p&gt;
&lt;p&gt;    Dim i As Long&lt;br&gt;
    Dim sTemp As String&lt;/p&gt;
&lt;p&gt;    For i = 1 To Len(sFolderName)&lt;br&gt;
         Select Case Mid$(sFolderName, i, 1)&lt;br&gt;
            Case &quot;/&quot;, &quot;&quot;, &quot;:&quot;, &quot;*&quot;, &quot;?&quot;, &quot;&quot;, &quot;&#124;&quot;&lt;br&gt;
                sTemp = sTemp &amp; &quot;_&quot;&lt;br&gt;
            Case Else&lt;br&gt;
                sTemp = sTemp &amp; Mid$(sFolderName, i, 1)&lt;br&gt;
        End Select&lt;br&gt;
    Next i&lt;/p&gt;
&lt;p&gt;    CleanFolderName = sTemp&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8216; The first line of this snippet should use the vbDirectory parameter ohterwise if a folder does<br />
&#8216; not contain any files it will not return a string value and will give a false indication of the<br />
&#8216; folder existance. To be sure to detect a directory&#8230;<br />
&#8216; Use this: If Len(Dir(sBaseFolder &amp; sTemp, vbDirectory)) = 0 Then<br />
&#8216; Or this: If Len(Dir(sBaseFolder &amp; sTemp, 16)) = 0 Then</p>
<p>&#8216; This will not detect a directory unless it contains a file.</p>
<p>        If Len(Dir(sBaseFolder &amp; sTemp)) = 0 Then<br />
            &#8216;Use MkDir to create the folder<br />
            MkDir sBaseFolder &amp; sTemp<br />
        End If</p>
<p>&#8216; I adapted the Procedure to create multiple new directories if not existing<br />
&#8216; It uses a loop to check each directory and create it if not existing.</p>
<p>Sub CreateFolders(sFolderPath As String)<br />
    Dim sSubFolder As String<br />
    Dim sBaseFolder As String<br />
    Dim sTemp As String</p>
<p>    ArryDir = Split(sFolderPath, &#8220;&#8221;)</p>
<p>    For i = 0 To UBound(ArryDir) &#8211; 2<br />
      sBaseFolder = sBaseFolder &amp; ArryDir(i)<br />
      sSubFolder = ArryDir(i + 1)<br />
      &#8216;Make sure the base folder is ready to have a sub folder<br />
      &#8216;tacked on to the end<br />
      If Right(sBaseFolder, 1)  &#8220;&#8221; Then<br />
          sBaseFolder = sBaseFolder &amp; &#8220;&#8221;<br />
      End If</p>
<p>      &#8216;Make sure base folder exists<br />
      If Len(Dir(sBaseFolder, vbDirectory)) &gt; 0 Then<br />
          &#8216;Replace illegal characters with an underscore<br />
          sTemp = CleanFolderName(sSubFolder)<br />
          &#8216;See if already exists: Thanks Dave W.<br />
          If Len(Dir(sBaseFolder &amp; sTemp, vbDirectory)) = 0 Then<br />
              &#8216;Use MkDir to create the folder<br />
              MkDir sBaseFolder &amp; sTemp<br />
          End If<br />
      End If<br />
    Next<br />
End Sub</p>
<p>Private Function CleanFolderName(ByVal sFolderName As String) As String</p>
<p>    Dim i As Long<br />
    Dim sTemp As String</p>
<p>    For i = 1 To Len(sFolderName)<br />
         Select Case Mid$(sFolderName, i, 1)<br />
            Case &#8220;/&#8221;, &#8220;&#8221;, &#8220;:&#8221;, &#8220;*&#8221;, &#8220;?&#8221;, &#8220;&#8221;, &#8220;|&#8221;<br />
                sTemp = sTemp &amp; &#8220;_&#8221;<br />
            Case Else<br />
                sTemp = sTemp &amp; Mid$(sFolderName, i, 1)<br />
        End Select<br />
    Next i</p>
<p>    CleanFolderName = sTemp</p>
<p>End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/#comment-19778</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Fri, 26 May 2006 13:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1419#comment-19778</guid>
		<description>&lt;p&gt;Best Approach is the one used in ASAP utilities - Create a lot of folders easily.&lt;br&gt;
The only problem is that the Make folder dialog always points to the MyComputer during start up... It would be nice if it would &quot;remember&quot; the last place path you created the folder ... that would have&lt;/p&gt;
&lt;p&gt;Sam&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Best Approach is the one used in ASAP utilities &#8211; Create a lot of folders easily.<br />
The only problem is that the Make folder dialog always points to the MyComputer during start up&#8230; It would be nice if it would &#8220;remember&#8221; the last place path you created the folder &#8230; that would have</p>
<p>Sam</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Wasserman</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/05/24/creating-folders-with-mkdir/#comment-19772</link>
		<dc:creator>David Wasserman</dc:creator>
		<pubDate>Thu, 25 May 2006 04:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1419#comment-19772</guid>
		<description>&lt;p&gt;Dick,&lt;/p&gt;
&lt;p&gt;You should check for the folder&#039;s existence after you clean the illegal characters. Otherwise, you run the risk of trying to create a folder that already is there.&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick,</p>
<p>You should check for the folder&#8217;s existence after you clean the illegal characters. Otherwise, you run the risk of trying to create a folder that already is there.</p>
<p>David</p>
]]></content:encoded>
	</item>
</channel>
</rss>

