1: Sub Macro4()
2: '
3: ' Macro4 Macro
4: '
5: '
6: For i = 1 To 400
7:
8: Selection.MoveRight Unit:=wdCharacter, Count:=1
9:
10: If (Selection.Range.HighlightColorIndex = wdBrightGreen) Then
11:
12: Selection.MoveLeft Unit:=wdCharacter, Count:=1
13:
14: Selection.TypeText Text:="G "
15:
16: ElseIf (Selection.Range.HighlightColorIndex = wdRed) Then
17:
18: Selection.MoveLeft Unit:=wdCharacter, Count:=1
19:
20: Selection.TypeText Text:="R "
21:
22: End If
23:
24: Selection.MoveLeft Unit:=wdCharacter, Count:=2
25: Selection.MoveDown Unit:=wdLine, Count:=1
26:
27: Next
28:
29: End Sub
References:
http://www.techonthenet.com/excel/formulas/isblank.php
http://stackoverflow.com/questions/4213140/inconsistent-looping-behavious-of-for-loop-in-vba
http://ask.metafilter.com/180226/How-to-selectively-count-words-in-Word-based-on-highlight-color
-urShadow
No comments:
Post a Comment