![]() ![]() Thanks for the info on the Range object - that also means you can go by word as well as by character (and sentences, but Word’s definition of a sentence is a bit sketchy).Īnother recurring topic on the board is iterating over each character, just like you’ve described. In the case of this last subroutine, instead of applying highlighting, I could just as easily have deleted those Heading 1 paragraphs, and still been able to move along the collection correctly, since I’ve already got my hands on the following paragraph, which becomes the current paragraph on the next trip through the loop.įor…Each loops are still my weapon of choice when doing standard iterations, but using the Next property technique (the “linked-list method” formally) has proved a valuable additon to my Word macro toolbox. If para.Style = doc.Styles(wdStyleHeading1) Then The third, which starts at the first paragraph and uses the Next property to move along, also took … 2 secondsįor k = To 1 Step -1. ![]() The second uses a For…Each loop, and was a bit speedier, at 2 seconds (yup!). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |