#1
|
|||
|
|||
Q: vba code to move from the first paragraph to next
For some reason, I need a vba code (word 2013) that
1) Moves first to the first paragraph 2) Selects the text in that paragraph 3) Do an event. Afterwards, it should move to the next paragraph .....etc. till the last paragraph. I've tried this code: Dim wdoc As Document Dim Para As Paragraph Set wdoc = ActiveDocument For Each Para In wdoc.Paragraphs do..... Next Para But it doesn't move to the next paragraph. Thanks in advance |
#2
|
||||
|
||||
The logic is OK if your 'event' doesn't remove the Para. However it sounds like you are doing exactly that. Normally, we get around this by working backwards through a collection.
See this thread for an approach that might work better https://www.msofficeforums.com/word-...paragraph.html
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Applying a VBA code to current paragraph without being selected | laith93 | Word VBA | 6 | 10-14-2022 11:10 PM |
Help with a logical code, end of paragraph lines | Cendrinne | Word VBA | 9 | 06-11-2021 09:39 PM |
Top of my VBA code window is hidden and I can't seem to move it | mrsjetset | Word VBA | 1 | 06-26-2016 07:41 AM |
Find Bookmark, move to bookmark, execute code, repeat | raymm3852 | Word VBA | 10 | 04-15-2016 06:21 PM |
Get para no where txt is found, and move text to end of paragraph using Word 201 | marceepoo | Word VBA | 2 | 12-20-2012 11:42 AM |