Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2022, 09:13 AM
mrwoggie mrwoggie is offline Select a specific number of characters in word using VBA Windows 11 Select a specific number of characters in word using VBA Office 2019
Novice
Select a specific number of characters in word using VBA
 
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
  #2  
Old 01-18-2022, 03:08 PM
macropod's Avatar
macropod macropod is offline Select a specific number of characters in word using VBA Windows 10 Select a specific number of characters in word using VBA Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

Tags
doc, selection, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select a specific number of characters in word using VBA Select and change font size of words by number of characters knpaddac Word VBA 3 03-15-2021 03:00 PM
Select a specific number of characters in word using VBA A Macro to break lines automatically after specific number of characters Annie Wordy Word VBA 1 11-03-2017 08:36 PM
Select a specific number of characters in word using VBA Deleting Characters in a specific location in Word 2010 ppayaw Word VBA 8 12-13-2016 08:11 AM
Select a specific number of characters in word using VBA 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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft