M
muyBN
I've got the following code in which I'm trying to use regular expressions:
'at top of module:
Dim Reg As RegExp
'in procedure:
Set Reg = New RegExp
Reg.Pattern = "\n"
With Selection
.MoveDown unit:=wdParagraph, Extend:=wdExtend
If InStr(LCase(Selection), "address") = 0 Then
If Selection <> Reg.Pattern Then .MoveDown unit:=wdParagraph,
Extend:=wdExtend
End If
The selected text is a paragraph mark yet the macro still moves down and
selects the next paragraph (meaning that it detects the original paragraph
mark as not being a paragraph mark). Where am I going wrong? I thought the \n
criteria was supposed to represent any type of line break.
'at top of module:
Dim Reg As RegExp
'in procedure:
Set Reg = New RegExp
Reg.Pattern = "\n"
With Selection
.MoveDown unit:=wdParagraph, Extend:=wdExtend
If InStr(LCase(Selection), "address") = 0 Then
If Selection <> Reg.Pattern Then .MoveDown unit:=wdParagraph,
Extend:=wdExtend
End If
The selected text is a paragraph mark yet the macro still moves down and
selects the next paragraph (meaning that it detects the original paragraph
mark as not being a paragraph mark). Where am I going wrong? I thought the \n
criteria was supposed to represent any type of line break.