Hi all. First of all I know that there are a lot of questions like mine, but I just can't solve it.
Secondly, this app have to export XML format from spritesheet to a file.
What I did is just create a simple button, added Macro and pasted this code into:
<root xmlns="" http:="" tempuri.org="" import.xsd""="">
When I have a basic table with data and a button, which when I press it, I get to the Save As screen. I save it as "out.xml" in my Desktop, but I when press OK, i got and error saying : " Run-time error '9': Subscript out of range ' ", and this
line becomes yellow. What I am doing wrong in here? Thank you very much and appreciate any help from you guys
.</root>
Secondly, this app have to export XML format from spritesheet to a file.
What I did is just create a simple button, added Macro and pasted this code into:
Code:
Sub ExportXML()
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
newFileName = Application.GetSaveAsFilename("out.xml", "XML Files (*.xml), *.xmls")
If newFileName = False Then
Exit Sub
End If
If objFSO.FileExists(newFileName) Then
objFSO.DeleteFile (newFileName)
End If
ActiveWorkbook.XmlMaps("Root_Map").Export URL:=newFileName
Set objFile = objFSO.OpenTextFile(newFileName, ForReading)
Dim count
count = 0
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If count = 0 Then
strNewContents = strNewContents & "<?xml version=""1.0"" ?>" & vbCrLf
ElseIf count = 1 Then
strNewContents = strNewContents & "<Root xmlns=""http://tempuri.org/import.xsd"">" & vbCrLf
Else
strNewContents = strNewContents & strLine & vbCrLf
End If
count = count + 1
Loop
objFile.Close
Set objFile = objFSO.OpenTextFile(newFileName, ForWriting)
objFile.Write strNewContents
objFile.Close
End Sub
When I have a basic table with data and a button, which when I press it, I get to the Save As screen. I save it as "out.xml" in my Desktop, but I when press OK, i got and error saying : " Run-time error '9': Subscript out of range ' ", and this
Code:
ActiveWorkbook.XmlMaps("Root_Map").Export URL:=newFileName