<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: deletefolder in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/deletefolder/m-p/2186799#M21066</link>
    <description>I have managed to isolate what causes this - it is the line&lt;BR /&gt;
&lt;BR /&gt;
If Dir$(dwgname, vbReadOnly) = "" Then 'no file present&lt;BR /&gt;
'Stuff&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
Although I have found it, I can not seem to understand how an If statement can cause this to occur, as nothing is being set. Any ideas??&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Brent</description>
    <pubDate>Fri, 22 Feb 2008 02:15:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-02-22T02:15:43Z</dc:date>
    <item>
      <title>deletefolder</title>
      <link>https://forums.autodesk.com/t5/vba-forum/deletefolder/m-p/2186798#M21065</link>
      <description>Hi Guys and Girls,&lt;BR /&gt;
&lt;BR /&gt;
I am having an issue with the deletefolder method.&lt;BR /&gt;
&lt;BR /&gt;
An outline of what I am trying to achieve:&lt;BR /&gt;
1. Creating directory structure copying template folders to the created project folder&lt;BR /&gt;
2. If there is Plot.dwt file missing, I have exited the program, and deleted the folder just created (this bit works).&lt;BR /&gt;
3. Once we get into the main area, if the user clicks cancel, I want the folder to be deleted, however it errors with "Permission denied"&lt;BR /&gt;
&lt;BR /&gt;
The code that works:&lt;BR /&gt;
'Test to see if file is there&lt;BR /&gt;
If Dir$(dwgname, vbReadOnly) = "" Then 'no file present&lt;BR /&gt;
    MsgBox "Can not find the Plot.dwt file in " &amp;amp; TxtLocation &amp;amp; ". Please ensure it is there and try again.", vbCritical, Me.Caption&lt;BR /&gt;
    &lt;BR /&gt;
    'delete folder that was created so the user can retry&lt;BR /&gt;
    Dim fs As FileSystemObject&lt;BR /&gt;
    Set fs = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;
    fs.DeleteFolder StrPath + TxtProjNum, True&lt;BR /&gt;
    Dim BlnNoFile As Boolean&lt;BR /&gt;
    BlnNoFile = True&lt;BR /&gt;
GoTo NoFile&lt;BR /&gt;
&lt;BR /&gt;
***********************************************************************&lt;BR /&gt;
The code that doesn't&lt;BR /&gt;
&lt;BR /&gt;
Private Sub CmdCancel_Click()&lt;BR /&gt;
If MsgBox("You are about to cancel the Project.inf setup. Do you wish to remove the project folder too?" &amp;amp; vbCrLf &amp;amp; vbCrLf _&lt;BR /&gt;
&amp;amp; "Note: leaving the folder structure in will prevent you from creating the project.inf file in future.", vbInformation + vbYesNo, Me.Caption) = vbYes Then&lt;BR /&gt;
&lt;BR /&gt;
    'delete folder that was created so the user can retry&lt;BR /&gt;
    Dim fs As FileSystemObject&lt;BR /&gt;
        Set fs = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;
    fs.DeleteFolder StrPath + TxtProjNum, True&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
Unload Me&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
any suggestions would be great&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Brent</description>
      <pubDate>Fri, 22 Feb 2008 01:31:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/deletefolder/m-p/2186798#M21065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-22T01:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: deletefolder</title>
      <link>https://forums.autodesk.com/t5/vba-forum/deletefolder/m-p/2186799#M21066</link>
      <description>I have managed to isolate what causes this - it is the line&lt;BR /&gt;
&lt;BR /&gt;
If Dir$(dwgname, vbReadOnly) = "" Then 'no file present&lt;BR /&gt;
'Stuff&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
Although I have found it, I can not seem to understand how an If statement can cause this to occur, as nothing is being set. Any ideas??&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Brent</description>
      <pubDate>Fri, 22 Feb 2008 02:15:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/deletefolder/m-p/2186799#M21066</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-22T02:15:43Z</dc:date>
    </item>
  </channel>
</rss>

