Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 08-29-2014, 08:12 AM
adj adj is offline How to get the Right function to return a string that has UPPERCASE letters only Windows 7 64bit How to get the Right function to return a string that has UPPERCASE letters only Office 2010 64bit
Novice
How to get the Right function to return a string that has UPPERCASE letters only
 
Join Date: Aug 2014
Posts: 5
adj is on a distinguished road
Default Code surrounding the Right function in question

Below is the current code (which I adapted from code I found online):

Code:
 
Selection.HomeKey Unit:=wdStory ' line 1
For Each rngRange In ActiveDocument.StoryRanges ' line 2
For Each rngSentence In rngRange.Sentences ' line 3
For Each rngWord In rngSentence.Words ' line 4
rngWord.Select ' line 5 SelectedText = Selection.Text ' line 6 If Right(SelectedText, 2) = "[A-Z][A-Z]" Then ' line 7 Else ' line 8 End If ' line 9
Next rngWord ' line 10
Next rngSentence ' line 11
Next rngRange ' line 12
In line 7 above, I'm trying to get the macro to identify the types of text strings I'm looking for (e.g., BC-3, ABC-5, BC-003, DA-378-A). I realize that maybe the For Each...Next (word) is not the best way to go about this, but it seems to work pretty well (as the main approach vs. using the Find approach).

Should I forget about the For Each...Next approach and stick with the Find approach?

Thanks
Reply With Quote
 

Tags
right function, upper



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the Right function to return a string that has UPPERCASE letters only Uppercase formula? clements55 Excel 1 08-20-2014 11:34 PM
How to get the Right function to return a string that has UPPERCASE letters only Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
How to get the Right function to return a string that has UPPERCASE letters only Can I use the filter function to separate letters into separate files? drhauser Mail Merge 2 12-14-2011 02:18 PM
How to get the Right function to return a string that has UPPERCASE letters only Day and Month to Uppercase Andy2011 Word VBA 1 07-22-2011 04:34 PM
How to get the Right function to return a string that has UPPERCASE letters only Macro or Function to know wether a string is included in a text Eduardo Word VBA 5 06-15-2009 01:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:34 PM.


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