![]() |
|
|
Thread Tools | Display Modes |
#8
|
|||
|
|||
![]()
Hi, again! If you don't mind here are some comments to your previous post.
1) If the cursor (aka selection or insertion point) is within a word (in our case a digit) that wd is considered selected. 'Within', besides within proper, also inlcudes the positions immediately before and after the word, What is more: 'within' also includes the word's trailing space! In other words, if the cursor is placed immediately before or on, or immediately after the word, or immediately after the word's trailing space, the word is treated as selected. That's why your digit becomes replaced. A rule of a thumb I use: if I want to make sure what the word is, I just double-click on it (use this technique to get surprised). If the word is followed by space, that space is also selected. Other punctuation signs do not belong to the previous word, they are individual words. 2) If you have error 5941 ("Requested Member of the Collection Does Not Exist"), most likely there's a paragraph break/empty paragraph in the selected range, which 'confuses' the code. In this case, I'd suggest adding another condition Code:
If Len(oPar.range) > 1 Then Code:
For Each oPar In oRng.Paragraphs Code:
End If Code:
Next oPar I hope the above tips/explanations will help and even "system-specific variations" of the code execution will disappear. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
yanyan9896 | Word VBA | 2 | 10-09-2023 04:59 AM |
Find/replace - symbol for all numbers or symbol letters (Word 97) | Genericname1111 | Word | 10 | 11-10-2019 10:37 PM |
![]() |
Yotem189 | Word VBA | 3 | 09-20-2018 05:55 AM |
Numbers format in word to arabic | Mzbarca | Word | 1 | 02-28-2016 07:56 PM |
Find and replace BETWEEN numbers | WordUser2015 | Word | 4 | 12-19-2014 02:09 PM |