So basically I'm working in Visual Basic and I have code that creates a .exe file. The .exe file, when run, prompts the user to select and xml file and upon the user selecting the file, it outputs the data into an organized, easy to understand format in Excel.
I am fairly new to Visual Basic and I'm having some issues. The main issue is I'm having trouble calling the specific subnode that I need. This particular subnode holds a lot of the data that I am interested in. The information that I need right now is a subnode of the node "general" and it is called "external." Within the subnode of "external," there are more subnodes. However, the subnodes that I need are called "input." However, each of the subnodes named "input" have different ids. So essentially what I want to do is write code that will call all subnodes of "general" that are called "external" and that also have a subnode of "input." Keeping in mind that I wanted to have the final product be a well organized Excel spreadsheet, it would also be beneficial for it to do this in an organized and sequential way.
The code I have is as follows:
Dim gen As Object
Dim gens As Object
Dim column As Integer
Dim trackings As Integer
Dim tracking As Integer
column = 2
gens = rootnode.selectnodes(".//external[@id='batch']")
For Each gen In gens
tracking = gen.GetAttribute("id")
trackings = gen.selectnodes("//input/data")
For Each trackings In tracking
xlSheet.Cells(5, column).Value = trackings
column = column + 1
Next
Next
Again, I'm fairly inexperienced with coding, so I apologize if I either made a stupid mistake or I'm doing something completely wrong.
Any help is greatly appreciated!
No comments:
Post a Comment