ITBeginnerKT
Technical User
Hi,
I am very new to the IT world. I am working with creating a macro using VBA in Word 2007. The objective of the macro is to highlight every 3rd line in yellow all the way through the document whether it is 10 lines, 10 paragraphs, or 10 pages long. I am including the information that I have recorded on the macro so far which has allowed it to highlight the 1st line and skip down 2 lines to get to the 3rd line. I am looking for the information that needs to go above and below the instructions that will allow it to perform the action until the end of a document.
I believe it is a "Do..Loop Until <condition>" type statement but I do not know what the condition is after until to be able to make it work. I am guessing that this is a very entry level type programming question but I would appreciate any assistance! Thank you for your help!
Do
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Options.DefaultHighlightColorIndex = wdYellow
Selection.Range.HighlightColorIndex = wdYellow
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=2
Loop Until <condition>
I am very new to the IT world. I am working with creating a macro using VBA in Word 2007. The objective of the macro is to highlight every 3rd line in yellow all the way through the document whether it is 10 lines, 10 paragraphs, or 10 pages long. I am including the information that I have recorded on the macro so far which has allowed it to highlight the 1st line and skip down 2 lines to get to the 3rd line. I am looking for the information that needs to go above and below the instructions that will allow it to perform the action until the end of a document.
I believe it is a "Do..Loop Until <condition>" type statement but I do not know what the condition is after until to be able to make it work. I am guessing that this is a very entry level type programming question but I would appreciate any assistance! Thank you for your help!
Do
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Options.DefaultHighlightColorIndex = wdYellow
Selection.Range.HighlightColorIndex = wdYellow
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=2
Loop Until <condition>