View Single Post
 
Old 08-29-2017, 09:23 PM
Helend269 Helend269 is offline Windows 7 32bit Office 2003
Novice
 
Join Date: Aug 2017
Posts: 15
Helend269 is on a distinguished road
Default

Thanks but I can't quite get it to work as I want it to. Perhaps I'd better explain what I want to do. I have something like this:

Random line that stays as it is.
TRIGGER LINE
This text to be made uppercase
Random line that stays as it is.
Random line that stays as it is.
Random line that stays as it is.
TRIGGER LINE
This text to be made uppercase
Random line that stays as it is.
Random line that stays as it is.
Random line that stays as it is.

I have a small bit of code from recording a macro that goes down one line from the TRIGGER LINE, selects the line where the cursor now is and makes it uppercase.

The problem is I have 3,000-odd instances of the TRIGGER LINE so I need to automate it.

The code I have to do this is:

Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.AllCaps = True
Selection.HomeKey Unit:=wdLine

I just need to be able to have something that searches for each instance of the text TRIGGER LINE and then runs my code. It would then move on to the next instance of TRIGGER LINE and repeat until the end of the document.

When I tried to put my code in your code it uppercased everything. It wasn't clear to me which part sof your code were interchangeable.
Reply With Quote