Hi everybody, I need some assistance with the following VBScript. I need to convert this into running under VB6 and has no idea as to why it keeps falling oover on line no 5. Would appreciate it if help could be given in this respect. Thanks ---------------------------------------------------- 1 Dim oDOM As New DOMDocument 2 Dim oDOMOut As New DOMDocument 3 Dim sXML 4 Call oDOM.Load("Vehicle.xml") 5 oDOM.selectSingleNode("//schemeid").Text = "1" 6 oDOM.selectSingleNode("//dateofbirth").Text = "21 jun 1970" 7 oDOM.selectSingleNode("//genderid").Text = "1" 8 sXML = x.QuoteWithPath(oDOM.XML, "") 9 oDOMOut.loadXML sXML 10 Debug.Print sXML 11 nNewPremium = oDOMOut.selectSingleNode("//grosspremium").Text 12 Set x = Nothing 13 Set oDOM = Nothing 14 Set oDOMOut = Nothing -------------------------------------------------------------
your code is not safe . if oDom.selectSingleNode can't find the node , it will return Nothing . and Nothing hasnot the text property . may be you can try this dim xdn set xdn= oDOM.selectSingleNode("//schemeid") if Not(xdn is nothing) then xdn.Text="1" else err.raise ,,"can't fiind node schemeid!" end if set xdn= oDOM.selectSingleNode("//dateofbirth") if Not(xdn is nothing) then xdn.Text="1" else err.raise ,,"can't fiind node dateofbirth!" end if . .