title: CreateObject working in excel 2003 but not 2010
body: <p>Essentially the code is just creating a text file in a directory that is filled with information.  Like the title says I can open the worksheet in excel 2003 and it will run fine but if it runs in 2010 there is an error that pops up saying Run-time error "70" Permission denied. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>Dim i As Integer
  Dim dataType As String
  Dim dataName As String
  
  Application.ScreenUpdating = False
  
  ChDir ThisWorkbook.Path  'sets the directory to where the workpaper is
  ChDir ".." 'Moves up a directory
  ChDir (".\folder\")
  
  direct = ThisWorkbook.Path
  
  Worksheets("SchSB XML").Select
  
  Set fs = CreateObject("Scripting.FileSystemObject")
  Set a = fs.CreateTextFile(direct &amp; "\" &amp; flName &amp;  ".xml", True)
  
  a.writeline ("&lt;?xml version=" &amp; Chr(34) &amp; "1.0" &amp; Chr(34) &amp; " encoding=" _
      &amp; Chr(34) &amp; "UTF-8" &amp; Chr(34) &amp; " standalone=" &amp; Chr(34) &amp; "yes" &amp; Chr(34) &amp; "?&gt;")
  a.writeline ("&lt;SchSB xmlns:ns1=" &amp; Chr(34) &amp; "http://efast.gov/2011" _
      &amp; Chr(34) &amp; " xmlns:xsi=" &amp; Chr(34) &amp; "http://ww.w3.org/2001/XMLSchema-instance" &amp; Chr(34) &amp; "&gt;")
  </code></pre>
  
  <p>There is a loop after this but it contains the same a.writeline code as above that rotates through ~100 cells</p>
  
  <p>Debug is showing the Set fs = CreateObject("Scripting.FileSystemObject") is breaking and showing the permission denied error. </p>