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.
Here is the 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 & "\" & flName & ".xml", True)
a.writeline ("<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" _
& Chr(34) & "UTF-8" & Chr(34) & " standalone=" & Chr(34) & "yes" & Chr(34) & "?>")
a.writeline ("<SchSB xmlns:ns1=" & Chr(34) & "http://efast.gov/2011" _
& Chr(34) & " xmlns:xsi=" & Chr(34) & "http://ww.w3.org/2001/XMLSchema-instance" & Chr(34) & ">")
There is a loop after this but it contains the same a.writeline code as above that rotates through ~100 cells
Debug is showing the Set fs = CreateObject("Scripting.FileSystemObject") is breaking and showing the permission denied error.
direct & "\" & flNameif you debug it? - Siddharth RoutfsIf you writeDim fs as Objectdoes it help? Or what if you use early binding? Does it work then? - Scott Holtzman