#1
|
|||
|
|||
Select a specific number of characters in word using VBA
Hi there! I have some .doc files with a lot of text, and I want to change the color of the text each 217 caracters. The first 217 caracters would be one color, the next 217 would be another color and so on. BUT, I also wanted to create a condition where: If the 217 caracters don't end with a period, them the selection must be reduced to the last period before 217. For example: "The car is blue. We need to go to the". In this case, the sentence: "We need to go to the" would not be selected, because it doesn't end with a period, so the selection would be "the car is blue.", because it does end with a period.
I don't know how can I do this in Word, I'm new to VBA and I don't know if it's possible because I'm used to Excel. Can someone help me? |
#2
|
||||
|
||||
Cross-posted (and answered) at: vba - Selecting a specific number of characters - Stack Overflow
For cross-posting etiquette, please read: Excelguru Help Site - A message to forum cross posters
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
doc, selection, vba |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Select and change font size of words by number of characters | knpaddac | Word VBA | 3 | 03-15-2021 03:00 PM |
A Macro to break lines automatically after specific number of characters | Annie Wordy | Word VBA | 1 | 11-03-2017 08:36 PM |
Deleting Characters in a specific location in Word 2010 | ppayaw | Word VBA | 8 | 12-13-2016 08:11 AM |
Cannot select single characters. Word selects paragraphs or parts of sentences. | TMinnich | Word | 2 | 10-25-2013 09:38 AM |
display number of characters in a word section | shootingluc | Word | 3 | 03-29-2012 03:25 PM |