Код:
Option Explicit
Dim strSourceFile
Dim strFromString, strToString
Dim objDomDocument
Dim objXMLDOMElement
Dim boolDeletion
strSourceFile = "C:\Мои проекты\0037\пример\пример.fb2"
strFromString = InputBox("From string") ' "Rinat-106 M"
strToString = InputBox("To string") ' "С нами: 3 года 2 месяца"
Set objDomDocument = WScript.CreateObject("Microsoft.XMLDOM")
objDomDocument.load(strSourceFile)
boolDeletion = False
For Each objXMLDOMElement In objDomDocument.selectNodes("/FictionBook/body/section/p")
If Not boolDeletion Then
If StrComp(objXMLDOMElement.text, strFromString, vbTextCompare) = 0 Then
objXMLDOMElement.parentNode.removeChild objXMLDOMElement
boolDeletion = True
End If
Else
objXMLDOMElement.parentNode.removeChild objXMLDOMElement
If StrComp(objXMLDOMElement.text, strToString, vbTextCompare) = 0 Then
boolDeletion = False
End If
End If
Next
objDomDocument.Save strSourceFile
Set objDomDocument = Nothing
WScript.Quit 0