VBA for MS Word not looping through all sentences in a paragraph -


i trying loop through sentences in word document , parse them semi-html code. during testing, ran interesting situation sentence followed non-closed sentence skipped. example, if have following 2 sentences:

this first sentence in paragraph special characters , there should 1 more sentence. second sentence should there.**

when loop through each sentence in paragraph.range.sentences, first sentence , ".**" @ end of paragraph. however, if add space between period , astriks, code works ". **".

how can make sure macro reads text in sentence, if there isn't space after period? example code below:

public sub parsedoc() dim paras paragraphs dim para paragraph dim sents sentences dim sent range       set paras = activedocument.paragraphs     each para in paras         set sents = para.range.sentences         each sent in sents             msgbox (sent.text)         next     next end sub 

it seems problem first asterisk. changing first asterisk else , code runs hoping. not know if special behavior, if reference activedocument.paragraphs(1).range.sentences(2).text full text of sentence expecting.

a simple reworking of loop(s) using while...wend , incremental counters, can reference items using index.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -