12/28/2023 0 Comments Vba word build range by paragraphAs code for extracting revisions from a document it won't be very robust. My fear is that going down this track is going to lead to some very fragile and unpredicatable code. I suppose I could also test for the presence of a period and skip "sentences" that are, in fact, not sentences. With the line length limit, I think they will still appear in Para 8, since of course it is not zero length. Without the zero length filter, any revisions in Para 6, Sentence 5 will also appear in a range restrict to Para 7, Para 8, and Para 9. Your recommendation is to simply test the paragraph length and skip it if the length is zero? I think I've tried this but I'll try it again. Revision Tracking in VBA seems to repeat any revisions in a paragraph/sentence prior to one of these manual headings (it's really a "blank," one line paragraph with no sentence becasue there is no period) until it encounters a real paragraph with real sentences in it. My recent posts in describe the problem. These one line, non sentence, "paragraphs" of text certainly do mess up Word's tracking of revisions. I don this by simply enter the heading (typing it in) and then entering a carriage return. In writing a document, I often manually include headings at various levels to block and organize the text for making it easier to read. What do you mean by using SpaceAfter and SpaceBefore formatting.? > should be using SpaceBefore or SpaceAfter formatting to generate space > Well, empty paragraphs in a document are "politically incorrect". Apparently, Word VBAĭoes not reset the rngSent when a new paragraph is encountered. This failed because the length is always the sameĪs the header in the previous (nonblank) line. Set the "sentence" for the 2nd paragraph to blank ("") but nothingġst try: Add Set rngSent = Nothing before Set rngSent =Ģnd try: Test the length of the sentence and if it is zero, force the Period at the end and the next line is a blank, the routine reprints This code works except if the "paragraph" is actually a header with no _Set rngPara = ActiveDocument.Paragraphs(I).Range By sentence number, I mean sentence number within the paragraph.įor I = 1 To
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |