Hello guys I have made following code
Could someone help me instead of hardcoded path's & filename
I would like to have a dialogwindow,
the loop open all xml files where I set the location, then loop through them and then save with the original name.
here is my code see below:
Thank you in advance
Could someone help me instead of hardcoded path's & filename
I would like to have a dialogwindow,
the loop open all xml files where I set the location, then loop through them and then save with the original name.
here is my code see below:
Code:
Sub xmlAddValues()
Dim analyse
Dim exactContexts
Dim subnode
Dim repeated
Dim realRepeated
Dim tmpValue
Set analyse = CreateObject("Msxml2.DOMDocument.6.0")
analyse.Load "C:\test\example.xml" ' HERE IS HARDCODED
Set exactContexts = analyse.SelectNodes("//inContextExact")
For i = 0 To exactContexts.Length - 1
Set subnode = exactContexts(i)
For Each att In subnode.Attributes
If att.Name = "words" Then
att.Value = "0"
Exit For
End If
Next att
Next i
Set repeated = analyse.SelectNodes("//crossFileRepeated")
For i = 0 To repeated.Length - 1
Set subnode = repeated(i)
For Each att In subnode.Attributes
If att.Name = "words" Then
tmpValue = att.Value
att.Value = "0"
Exit For
End If
Next att
Set realRepeated = subnode.NextSibling
For Each att In realRepeated.Attributes
If att.Name = "words" Then
att.Value = Val(att.Value) + Val(tmpValue)
Exit For
End If
Next att
Next i
analyse.Save "C:\test\Example.xml" ' HERE IS HARDCODED
End Sub
Thank you in advance