View Single Post
 
Old 01-18-2022, 09:13 AM
mrwoggie mrwoggie is offline Windows 11 Office 2019
Novice
 
Join Date: Jan 2022
Posts: 1
mrwoggie is on a distinguished road
Post 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?
Reply With Quote