vendredi 15 juillet 2016

translate javascript/jquery to vba

I have this javascript/jquery code that deletes sections of a html file

    var divs = document.getElementsByTagName('div');
var d = divs.length;
for (var i = 1; i < d; i++) {
    if( $('.section'+i).innerHTML.includes("textfind")==true || $('.section'+i).innerHTML.includes("textfind2")==true){
    $('.section'+i).remove();
    }
}

I would like write the same function as vba code for word

I have this code so far

Dim i as Long
    For each objSect in ActiveDocument.sections
        if objSect.Range.Text like "textfind +i" Or "textfind2+i" then objSect.range.delete
    Next objSect

how would I got about deleting those particular section where i find the strings

Aucun commentaire:

Enregistrer un commentaire