上述代码是指已选定的当前,下列代码应用于光标位置行(即没有选定): Sub test2()
Dim MyRange As Range, SelStart As Long, SelEnd As Long, StSel As Range
On Error Resume Next
Application.ScreenUpdating = False
With Selection
Set StSel = .Range
SelStart = .Start
.MoveDown
SelEnd = .Start + 1
Set MyRange = ActiveDocument.Range(SelStart, SelEnd)
If MyRange Like "*" & Chr(13) = True And _
MyRange.Find.Execute(findtext:="^m") = True Then _
MsgBox "当前行中有手动分页符"
StSel.Select
End With
Application.ScreenUpdating = True
End Sub 如果BUTTON兄不是用代码,则在工具/选项/视图:格式标记全部前打勾。 |