#1
|
|||
|
|||
Finding special characters
Hello
I want to select sentences which are start by special characters (e.g. com) and 2 characters after it (e.g. compa in company, comat in comate, combe in comber). How can I do it? |
#2
|
||||
|
||||
You could approach this two ways:
1. Iterate through every 'sentence' and check the value of the first three characters. eg. Code:
Sub aTest() Dim aSentence As Range For Each aSentence In ActiveDocument.Sentences If Left(aSentence.Text, 3) = "com" Then 'Do something Debug.Print aSentence.Text End If Next aSentence End Sub #1 uses Word's definition of a sentence so it is simpler but is likely to be slower. #2 would probably be faster but you would need to work out a definition of what constitutes a Sentence.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Special keyboard characters | originalsbyterry | Word | 12 | 12-25-2018 03:10 AM |
Special characters in Word | Peter Maggs | Word | 8 | 01-13-2017 02:41 PM |
Search all special characters in MS word 2007 | dshrish | Word | 3 | 03-28-2013 05:23 AM |
Macros and special characters. | oldzack | Word | 3 | 10-31-2011 04:16 AM |
Special Characters missing | timorrill | Word | 1 | 06-09-2009 11:34 PM |