Parse Excel to xml using VBA
I have VBA code that wirtes an Excel table to an xml file (actually writing the xml file line by line, tags equal column headers).
This is the code, it is quite straight forward.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Application.ScreenUpdating = False
Q = Chr$(34)
Dim sXML As String
sXML = "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
sXML = sXML & "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
sXML = sXML & "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
sXML = sXML & "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
sXML = sXML & Trim$(Cells(iRow, icol))
sXML = sXML & "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
sXML = sXML & "</" & NodeName & ">"
iRow = iRow + 1
Wend
sXML = sXML & "</root>"
Dim nDestFile As Integer, sText As String
''Close any open text files
Close
''Get the number of the next free text file
nDestFile = FreeFile
''Write the entire file to sText
Open sOutputFileName For Output As #nDestFile
Print #nDestFile, sXML
Close
Application.ScreenUpdating = True
End Sub
Sub ExcelToXml()
Dim FileName As String
FileName = InputBox("Dateinamen eingeben:")
Call MakeXML(1, 2, ActiveWorkbook.Path & "" & FileName & ".xml")
End Sub
The problem I have here occurs at files of around 2000 lines (also depends on the number of columns): Excel freezes and I have to kill it. i assume there might be a memory problem. How can I make this more stable?
Thanks!
microsoft-excel microsoft-excel-2010 vba xml
add a comment |
I have VBA code that wirtes an Excel table to an xml file (actually writing the xml file line by line, tags equal column headers).
This is the code, it is quite straight forward.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Application.ScreenUpdating = False
Q = Chr$(34)
Dim sXML As String
sXML = "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
sXML = sXML & "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
sXML = sXML & "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
sXML = sXML & "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
sXML = sXML & Trim$(Cells(iRow, icol))
sXML = sXML & "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
sXML = sXML & "</" & NodeName & ">"
iRow = iRow + 1
Wend
sXML = sXML & "</root>"
Dim nDestFile As Integer, sText As String
''Close any open text files
Close
''Get the number of the next free text file
nDestFile = FreeFile
''Write the entire file to sText
Open sOutputFileName For Output As #nDestFile
Print #nDestFile, sXML
Close
Application.ScreenUpdating = True
End Sub
Sub ExcelToXml()
Dim FileName As String
FileName = InputBox("Dateinamen eingeben:")
Call MakeXML(1, 2, ActiveWorkbook.Path & "" & FileName & ".xml")
End Sub
The problem I have here occurs at files of around 2000 lines (also depends on the number of columns): Excel freezes and I have to kill it. i assume there might be a memory problem. How can I make this more stable?
Thanks!
microsoft-excel microsoft-excel-2010 vba xml
How many lines do you have? Bear in mind, VBA is single threaded and calls will block. As such, intensive loops will lock up excel until it completes.
– Jonno
Jan 19 '16 at 9:13
Did you check your RAM and CPU usage during this task? It may be your machine doens't have the resource (although I'd expect you'd see an "out of memory exception" message)
– Dave
Jan 19 '16 at 9:55
@Jonno: I have up to 20k lines.
– Willi Fischer
Jan 19 '16 at 11:28
@Dave: Since I am running this in a Citrix environment, I cannot monitor CPU and RAM, unfortunately
– Willi Fischer
Jan 19 '16 at 11:34
add a comment |
I have VBA code that wirtes an Excel table to an xml file (actually writing the xml file line by line, tags equal column headers).
This is the code, it is quite straight forward.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Application.ScreenUpdating = False
Q = Chr$(34)
Dim sXML As String
sXML = "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
sXML = sXML & "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
sXML = sXML & "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
sXML = sXML & "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
sXML = sXML & Trim$(Cells(iRow, icol))
sXML = sXML & "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
sXML = sXML & "</" & NodeName & ">"
iRow = iRow + 1
Wend
sXML = sXML & "</root>"
Dim nDestFile As Integer, sText As String
''Close any open text files
Close
''Get the number of the next free text file
nDestFile = FreeFile
''Write the entire file to sText
Open sOutputFileName For Output As #nDestFile
Print #nDestFile, sXML
Close
Application.ScreenUpdating = True
End Sub
Sub ExcelToXml()
Dim FileName As String
FileName = InputBox("Dateinamen eingeben:")
Call MakeXML(1, 2, ActiveWorkbook.Path & "" & FileName & ".xml")
End Sub
The problem I have here occurs at files of around 2000 lines (also depends on the number of columns): Excel freezes and I have to kill it. i assume there might be a memory problem. How can I make this more stable?
Thanks!
microsoft-excel microsoft-excel-2010 vba xml
I have VBA code that wirtes an Excel table to an xml file (actually writing the xml file line by line, tags equal column headers).
This is the code, it is quite straight forward.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Application.ScreenUpdating = False
Q = Chr$(34)
Dim sXML As String
sXML = "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
sXML = sXML & "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
sXML = sXML & "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
sXML = sXML & "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
sXML = sXML & Trim$(Cells(iRow, icol))
sXML = sXML & "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
sXML = sXML & "</" & NodeName & ">"
iRow = iRow + 1
Wend
sXML = sXML & "</root>"
Dim nDestFile As Integer, sText As String
''Close any open text files
Close
''Get the number of the next free text file
nDestFile = FreeFile
''Write the entire file to sText
Open sOutputFileName For Output As #nDestFile
Print #nDestFile, sXML
Close
Application.ScreenUpdating = True
End Sub
Sub ExcelToXml()
Dim FileName As String
FileName = InputBox("Dateinamen eingeben:")
Call MakeXML(1, 2, ActiveWorkbook.Path & "" & FileName & ".xml")
End Sub
The problem I have here occurs at files of around 2000 lines (also depends on the number of columns): Excel freezes and I have to kill it. i assume there might be a memory problem. How can I make this more stable?
Thanks!
microsoft-excel microsoft-excel-2010 vba xml
microsoft-excel microsoft-excel-2010 vba xml
asked Jan 19 '16 at 9:09
Willi Fischer
84
84
How many lines do you have? Bear in mind, VBA is single threaded and calls will block. As such, intensive loops will lock up excel until it completes.
– Jonno
Jan 19 '16 at 9:13
Did you check your RAM and CPU usage during this task? It may be your machine doens't have the resource (although I'd expect you'd see an "out of memory exception" message)
– Dave
Jan 19 '16 at 9:55
@Jonno: I have up to 20k lines.
– Willi Fischer
Jan 19 '16 at 11:28
@Dave: Since I am running this in a Citrix environment, I cannot monitor CPU and RAM, unfortunately
– Willi Fischer
Jan 19 '16 at 11:34
add a comment |
How many lines do you have? Bear in mind, VBA is single threaded and calls will block. As such, intensive loops will lock up excel until it completes.
– Jonno
Jan 19 '16 at 9:13
Did you check your RAM and CPU usage during this task? It may be your machine doens't have the resource (although I'd expect you'd see an "out of memory exception" message)
– Dave
Jan 19 '16 at 9:55
@Jonno: I have up to 20k lines.
– Willi Fischer
Jan 19 '16 at 11:28
@Dave: Since I am running this in a Citrix environment, I cannot monitor CPU and RAM, unfortunately
– Willi Fischer
Jan 19 '16 at 11:34
How many lines do you have? Bear in mind, VBA is single threaded and calls will block. As such, intensive loops will lock up excel until it completes.
– Jonno
Jan 19 '16 at 9:13
How many lines do you have? Bear in mind, VBA is single threaded and calls will block. As such, intensive loops will lock up excel until it completes.
– Jonno
Jan 19 '16 at 9:13
Did you check your RAM and CPU usage during this task? It may be your machine doens't have the resource (although I'd expect you'd see an "out of memory exception" message)
– Dave
Jan 19 '16 at 9:55
Did you check your RAM and CPU usage during this task? It may be your machine doens't have the resource (although I'd expect you'd see an "out of memory exception" message)
– Dave
Jan 19 '16 at 9:55
@Jonno: I have up to 20k lines.
– Willi Fischer
Jan 19 '16 at 11:28
@Jonno: I have up to 20k lines.
– Willi Fischer
Jan 19 '16 at 11:28
@Dave: Since I am running this in a Citrix environment, I cannot monitor CPU and RAM, unfortunately
– Willi Fischer
Jan 19 '16 at 11:34
@Dave: Since I am running this in a Citrix environment, I cannot monitor CPU and RAM, unfortunately
– Willi Fischer
Jan 19 '16 at 11:34
add a comment |
1 Answer
1
active
oldest
votes
I used the same code, and it works but it does lock up the CPU for a very long time working it out. Excel is still working, but it freezes up the user interface as VBA uses a single thread.
I've adapted it to dump straight to a file stream, instead of holding it in memory and writing it all at the end, try replacing your MakeXML
function with this. You will also be able to monitor the file as it's being written to see if it does indeed crash and it hopefully should run faster. Let me know if there are any problems and I can tweak the code.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFile As Object
Set oFile = fso.CreateTextFile(sOutputFileName)
Application.ScreenUpdating = False
Q = Chr$(34)
oFile.Write "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
oFile.Write "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
oFile.Write "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
oFile.Write "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
oFile.Write Trim$(Cells(iRow, icol))
oFile.Write "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
oFile.Write "</" & NodeName & ">"
iRow = iRow + 1
Wend
oFile.Write "</root>"
oFile.Close
Application.ScreenUpdating = True
End Sub
Thanks! While my initial code eventually worked after long waiting time, your solution seems to be a lot faster. I cannot upvote due to lack of reputation :(
– Willi Fischer
Jan 19 '16 at 16:25
@WilliFischer That's fine, I hit the rep limit for today anyway ;) Glad it worked for you, it seemed near instant when I tested it
– Jonno
Jan 19 '16 at 16:31
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1028329%2fparse-excel-to-xml-using-vba%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I used the same code, and it works but it does lock up the CPU for a very long time working it out. Excel is still working, but it freezes up the user interface as VBA uses a single thread.
I've adapted it to dump straight to a file stream, instead of holding it in memory and writing it all at the end, try replacing your MakeXML
function with this. You will also be able to monitor the file as it's being written to see if it does indeed crash and it hopefully should run faster. Let me know if there are any problems and I can tweak the code.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFile As Object
Set oFile = fso.CreateTextFile(sOutputFileName)
Application.ScreenUpdating = False
Q = Chr$(34)
oFile.Write "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
oFile.Write "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
oFile.Write "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
oFile.Write "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
oFile.Write Trim$(Cells(iRow, icol))
oFile.Write "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
oFile.Write "</" & NodeName & ">"
iRow = iRow + 1
Wend
oFile.Write "</root>"
oFile.Close
Application.ScreenUpdating = True
End Sub
Thanks! While my initial code eventually worked after long waiting time, your solution seems to be a lot faster. I cannot upvote due to lack of reputation :(
– Willi Fischer
Jan 19 '16 at 16:25
@WilliFischer That's fine, I hit the rep limit for today anyway ;) Glad it worked for you, it seemed near instant when I tested it
– Jonno
Jan 19 '16 at 16:31
add a comment |
I used the same code, and it works but it does lock up the CPU for a very long time working it out. Excel is still working, but it freezes up the user interface as VBA uses a single thread.
I've adapted it to dump straight to a file stream, instead of holding it in memory and writing it all at the end, try replacing your MakeXML
function with this. You will also be able to monitor the file as it's being written to see if it does indeed crash and it hopefully should run faster. Let me know if there are any problems and I can tweak the code.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFile As Object
Set oFile = fso.CreateTextFile(sOutputFileName)
Application.ScreenUpdating = False
Q = Chr$(34)
oFile.Write "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
oFile.Write "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
oFile.Write "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
oFile.Write "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
oFile.Write Trim$(Cells(iRow, icol))
oFile.Write "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
oFile.Write "</" & NodeName & ">"
iRow = iRow + 1
Wend
oFile.Write "</root>"
oFile.Close
Application.ScreenUpdating = True
End Sub
Thanks! While my initial code eventually worked after long waiting time, your solution seems to be a lot faster. I cannot upvote due to lack of reputation :(
– Willi Fischer
Jan 19 '16 at 16:25
@WilliFischer That's fine, I hit the rep limit for today anyway ;) Glad it worked for you, it seemed near instant when I tested it
– Jonno
Jan 19 '16 at 16:31
add a comment |
I used the same code, and it works but it does lock up the CPU for a very long time working it out. Excel is still working, but it freezes up the user interface as VBA uses a single thread.
I've adapted it to dump straight to a file stream, instead of holding it in memory and writing it all at the end, try replacing your MakeXML
function with this. You will also be able to monitor the file as it's being written to see if it does indeed crash and it hopefully should run faster. Let me know if there are any problems and I can tweak the code.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFile As Object
Set oFile = fso.CreateTextFile(sOutputFileName)
Application.ScreenUpdating = False
Q = Chr$(34)
oFile.Write "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
oFile.Write "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
oFile.Write "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
oFile.Write "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
oFile.Write Trim$(Cells(iRow, icol))
oFile.Write "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
oFile.Write "</" & NodeName & ">"
iRow = iRow + 1
Wend
oFile.Write "</root>"
oFile.Close
Application.ScreenUpdating = True
End Sub
I used the same code, and it works but it does lock up the CPU for a very long time working it out. Excel is still working, but it freezes up the user interface as VBA uses a single thread.
I've adapted it to dump straight to a file stream, instead of holding it in memory and writing it all at the end, try replacing your MakeXML
function with this. You will also be able to monitor the file as it's being written to see if it does indeed crash and it hopefully should run faster. Let me know if there are any problems and I can tweak the code.
Sub MakeXML(iCaptionRow As Integer, iDataStartRow As Integer, sOutputFileName As String)
Dim Q As String
Dim NodeName As String
Dim AtributName As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFile As Object
Set oFile = fso.CreateTextFile(sOutputFileName)
Application.ScreenUpdating = False
Q = Chr$(34)
oFile.Write "<?xml version=" & Q & "1.0" & Q & " encoding=" & Q & "UTF-8" & Q & "?>"
oFile.Write "<root>"
NodeName = "node"
AtributName = "test"
''--determine count of columns
Dim iColCount As Integer
iColCount = 1
While Trim$(Cells(iCaptionRow, iColCount)) > ""
iColCount = iColCount + 1
Wend
Dim iRow As Integer
iRow = iDataStartRow
While Cells(iRow, 1) > ""
oFile.Write "<" & NodeName & " type=" & Q & AtributName & Q & " id=" & Q & iRow & Q & ">"
For icol = 1 To iColCount - 1
oFile.Write "<" & Trim$(Cells(iCaptionRow, icol)) & ">"
oFile.Write Trim$(Cells(iRow, icol))
oFile.Write "</" & Trim$(Cells(iCaptionRow, icol)) & ">"
Next
oFile.Write "</" & NodeName & ">"
iRow = iRow + 1
Wend
oFile.Write "</root>"
oFile.Close
Application.ScreenUpdating = True
End Sub
answered Jan 19 '16 at 11:45
Jonno
17.6k44663
17.6k44663
Thanks! While my initial code eventually worked after long waiting time, your solution seems to be a lot faster. I cannot upvote due to lack of reputation :(
– Willi Fischer
Jan 19 '16 at 16:25
@WilliFischer That's fine, I hit the rep limit for today anyway ;) Glad it worked for you, it seemed near instant when I tested it
– Jonno
Jan 19 '16 at 16:31
add a comment |
Thanks! While my initial code eventually worked after long waiting time, your solution seems to be a lot faster. I cannot upvote due to lack of reputation :(
– Willi Fischer
Jan 19 '16 at 16:25
@WilliFischer That's fine, I hit the rep limit for today anyway ;) Glad it worked for you, it seemed near instant when I tested it
– Jonno
Jan 19 '16 at 16:31
Thanks! While my initial code eventually worked after long waiting time, your solution seems to be a lot faster. I cannot upvote due to lack of reputation :(
– Willi Fischer
Jan 19 '16 at 16:25
Thanks! While my initial code eventually worked after long waiting time, your solution seems to be a lot faster. I cannot upvote due to lack of reputation :(
– Willi Fischer
Jan 19 '16 at 16:25
@WilliFischer That's fine, I hit the rep limit for today anyway ;) Glad it worked for you, it seemed near instant when I tested it
– Jonno
Jan 19 '16 at 16:31
@WilliFischer That's fine, I hit the rep limit for today anyway ;) Glad it worked for you, it seemed near instant when I tested it
– Jonno
Jan 19 '16 at 16:31
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1028329%2fparse-excel-to-xml-using-vba%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How many lines do you have? Bear in mind, VBA is single threaded and calls will block. As such, intensive loops will lock up excel until it completes.
– Jonno
Jan 19 '16 at 9:13
Did you check your RAM and CPU usage during this task? It may be your machine doens't have the resource (although I'd expect you'd see an "out of memory exception" message)
– Dave
Jan 19 '16 at 9:55
@Jonno: I have up to 20k lines.
– Willi Fischer
Jan 19 '16 at 11:28
@Dave: Since I am running this in a Citrix environment, I cannot monitor CPU and RAM, unfortunately
– Willi Fischer
Jan 19 '16 at 11:34