im not a familiar with programming basics.
im getting ‘Run time error 424 ‘ object required, when executing the script provided in #5
im using the script as macro in Excel, any idea what im doing wrong?
Sub XMLFind()
‘==== begin vbscript “xmlfind”
If wscript.arguments.Count < 1 Then
wscript.echo “Usage: XMLFIND C:\Users\vik\Documents\XMLTest\CD_catalog.xml targetstring”
wscript.Quit
End If
targ = wscript.arguments(1)
Set fso = CreateObject(“scripting.filesystemobject”)
Set test = fso.opentextfile(wscript.arguments(0), 1)
Z = test.readall
‘remove lcase() from foll line to observe case in search
point1 = InStr(LCase(Z), LCase(targ))
If point1 = 0 Then
wscript.echo “NOT FOUND: string: ” & targ
wscript.Quit
End If
point1 = point1 + Len(targ)
found = LTrim(Mid(Z, point1))
quote = Left(found, 1)
found = Mid(found, 2)
point2 = InStr(found, quote)
If point2 > 0 Then
found = Left(found, point2 – 1)
End If
wscript.echo Chr(34) & found & Chr(34)
‘===== end vbscript
End Sub
Script obtained from below link:
https://computing.net/answers/pr…
End result:
what i’m trying to do is to create macro or batch to extract a field name & its value from a xml file.
The XML file im using is contain 4 or 5 level nodes.
message edited by vennpura
I don’t have easy access to Excel at the moment, but from memory, something like this?:
How To Ask Questions The Smart Way