- 精华
- 活跃值
-
- 积分
- 161
- 违规
-
- 印币
-
- 鲜花值
-
- 在线时间
- 小时
累计签到:47 天 连续签到:0 天
|
发表于 2017-8-24 14:11:21
|
显示全部楼层
Sub mainBody()
Dim toStart As Integer, toEnd As Integer
a = InputBox(1, 2)
If InStr(a, "-") = 0 Then MsgBox "请用'-'分开两个页码": Exit Sub
toStart = Int(Split(a, "-")(0))
toEnd = Int(Split(a, "-")(1))
If toEnd > ActiveDocument.Pages.Count Then MsgBox "您输入的页数过多": Exit Sub
If toEnd <= toStart Then MsgBox "您输入的起始页大于或等于结束页": Exit Sub
ActiveDocument.BeginCommandGroup
ActiveDocument.DeletePages toStart, toEnd - toStart + 1
Application.Refresh
ActiveDocument.EndCommandGroup
End Sub
|
|