Dim job Dim action Dim SDate Dim nNode Dim flag Dim selectflag Dim formatDate Dim month Dim day Dim calcDate Dim newDate flag = "Manage" Set job = XDocument.DOM.selectNodes("//dfs:myFields/dfs:dataFields/d:WFPJob") job.reset() Set nNode = job.nextNode() While Not(nNode Is Nothing) selectflag = nNode.selectSingleNode("@SelectFlag").text If flag = selectflag Then SDate = nNode.selectSingleNode("@SDate").text End IF Set nNode = job.nextNode() WEnd Trim(SDate) formatDate = DateSerial(Mid(SDate, 1, 4), Mid(SDate, 6, 2), Mid(SDate, 9, 2)) calcDate = DateAdd("d",-90,formatDate) month = DatePart("M", calcDate) If Len(month) = 1 Then month= "0" & month End If day = DatePart("D", calcDate) If Len(day) = 1 Then day = "0" & day End If newDate = DatePart("YYYY", calcDate) & "-" & month & "-" & day Set action = XDocument.DOM.selectNodes("//dfs:myFields/dfs:dataFields/d:WFPJob/d:WFPAction") action.reset() Set nNode = action.nextNode() While Not(nNode Is Nothing) selectflag =nNode.selectSingleNode("@SelectFlag").text If flag = selectflag Then nNode.selectSingleNode("@ActionDate").text = newDate End IF Set nNode = action.nextNode() WEnd