For i = 1 To 500
With Selection.Find
.Text = " ^?^? ": .Replacement.Text = "": .Forward = True: .Wrap = wdFindStop: .Format = True
End With
Selection.Find.Execute
If Selection.Find.Found = False Then GoTo Ent2
ss = Selection
If InStr(ss, "XE") Then GoTo sk [COLOR="Navy"]' пока только так умею[/COLOR]
[COLOR="DarkGreen"]Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1[/COLOR]
sk:
Next i
Ent2:
Как можно проскочить ненужную итерацию в цикле?
Код:
Т.е. можно ли как-то не выполнять "зеленые" операции, если есть доп. условие?
Спасибо.
Код:
If InStr(ss, "XE") Then GoTo sk
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
sk:
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
sk:
использовать эту:
Код:
If InStr(ss, "XE") > 0 Then
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
End IF
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
End IF