|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub lkyy()
Dim doc As Document, Page_c As Byte, Ipt_start As Long, Ipt_end As Long
Dim Pstart As Long, Pend As Long, MyRange As Range
Set doc = ActiveDocument
Page_c = doc.ComputeStatistics(wdStatisticPages)
Ipt_start = InputBox("请输入起始页", , 1)
Ipt_end = InputBox("请输入结束页", , 2)
If Ipt_start > Page_c Then Exit Sub
If Ipt_end > Page_c Then Exit Sub
Selection.GoTo wdGoToPage, , Ipt_start
Pstart = Selection.Start
If Ipt_end = Page_c Then
Selection.EndKey unit:=wdStory
Pend = Selection.End
Else
Selection.GoTo wdGoToPage, , Ipt_end + 1
Pend = Selection.Start
End If
Set MyRange = Range(Pstart, Pend)
For i = 1 To MyRange.Paragraphs.Count
ps = MyRange.Paragraphs(i).Range.Start
n = 1
ch = ""
Do Until ch = "。"
ch = MyRange.Paragraphs(i).Range.Characters(n)
n = n + 1
Loop
doc.Range(ps, ps + n - 1).Font.ColorIndex = wdDarkRed
Next
End Sub
d)
For i = 1 To MyRange.Paragraphs.Count
ps = MyRange.Paragraphs(i).Range.Sta? |
评分
-
1
查看全部评分
-
|