0

I got a fix for this code on this thread and now Im getting a Permission 70 even if I save it to my desktop path. Have tried multiple paths and still no luck.

Rows to individual xml files including content value

ERROR MESSAGE WHEN RUNNING

Sub Export()

sTemplateXML = _
        "<data>" + vbNewLine + _
        "   <Name/>" + vbNewLine + _
        "   <AXCustNum/>" + vbNewLine + _
        "   <CustomerName/>" + vbNewLine + _
        "   <Title/>" + vbNewLine + _
        "   <Folder/>" + vbNewLine + _
        "</data>" + vbNewLine

 Set doc = CreateObject("MSXML2.DOMDocument")
 doc.async = False
 doc.validateOnParse = False
 doc.resolveExternals = False

With Sheets("SAL Checked File Names 1.9")
  lLastRow = .UsedRange.Rows.Count

 For lRow = 2 To lLastRow
   sname = .Cells(lRow, 1).Value
   saxcustnum = .Cells(lRow, 2).Value
   scustomername = .Cells(lRow, 3).Value
   sTitle = .Cells(lRow, 4).Value
   sFolder = .Cells(lRow, 5).Value
   
   
   doc.LoadXML sTemplateXML
   doc.getElementsByTagName("Name")(0).appendChild doc.createTextNode(sname)
   doc.getElementsByTagName("AXCustNum")(0).appendChild doc.createTextNode(saxcustnum)
   doc.getElementsByTagName("CustomerName")(0).appendChild doc.createTextNode(scustomername)
   doc.getElementsByTagName("Title")(0).appendChild doc.createTextNode(sTitle)
   doc.getElementsByTagName("Folder")(0).appendChild doc.createTextNode(sFolder)

   doc.Save sFolder
   Next
   
   End With
 
End Sub

I think it is erroring at "doc.Save sFolder"

braX
  • 11,506
  • 5
  • 20
  • 33

1 Answers1

0

Shrotter advice worked. I needed to change the column in excel with full filepath which I updated to include document name and then with .xml at the end. You wouldn't believe how long I obsessed over this today. So good to have an outcome. Thank you –