VBA全选word当前页代码
时间:2023-12-13 10:11:06
下面的代码的功能是,全选word文档的当前页,注意,是当前页,即插入条所在的页,而不是全文。
Dim CurrentPageStart As Long, CurrentPageEnd As Long, myRange As Range
Dim Currentpage As Integer, Pages As Integer
On Error Resume Next
Currentpage = Selection.Information(wdActiveEndPageNumber)
Pages = Selection.Information(wdNumberOfPagesInDocument)
CurrentPageStart = Selection.GoTo(what:=wdGoToPage, Which:=wdGoToNext, Name:=Currentpage).start
If Currentpage = Pages Then
CurrentPageEnd = ActiveDocument.Content.End
Else
CurrentPageEnd = Selection.GoTo(what:=wdGoToPage, Which:=wdGoToNext, Name:=Currentpage + 1).start
End If
Set myRange = ActiveDocument.Range(CurrentPageStart, CurrentPageEnd)
myRange.Select
注意,以上代码在VBA环境下使用。
标签:VBA全选word当前页代码
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
电脑打不开wampserver服务器的localhost怎么解决?
2022-04-18 15:02:31
![](https://img.aspxhome.com/file/2023/1/a273721_0s.jpg)
移动硬盘不显示在我的电脑怎么办?
2023-02-01 15:14:10
![](https://img.aspxhome.com/file/2023/6/a321615_0s.jpg)
教你如何鉴定苹果18w快充的真假?
2023-05-22 12:10:25
![](https://img.aspxhome.com/file/2023/3/a195863_0s.png)
WPS轻松办公—如何快速输入指定班级
2022-12-13 18:35:16
win7系统下IE浏览器点击右键菜单显示英文的解决
2022-04-25 23:46:43
![](https://img.aspxhome.com/file/2023/5/a315691_0s.jpg)
win10 高对比度的反转颜色的设置方法介绍
2022-04-04 16:19:26
![](https://img.aspxhome.com/file/2023/29/a252541_0s.jpg)
win10退域后无法切换用户怎么解决
2022-10-29 01:45:58
![](https://img.aspxhome.com/file/2023/1/a281125_0s.jpg)
Adobe Acrobat Pro DC 2019mac如何旋转、移动、删除和重新编号 PDF 页面?
2023-03-10 17:52:03
![](https://img.aspxhome.com/file/2023/3/a213283_0s.png)
win102004流氓软件怎么阻止_win102004流氓软件阻止方法
2023-12-25 12:43:22
![](https://img.aspxhome.com/file/2023/4/a305545_0s.jpg)
Win7系统如何设置定时关机?
2023-06-11 18:51:26
![](https://img.aspxhome.com/file/2023/4/a311486_0s.png)
Win10如何添加可靠多播网络协议?
2023-11-22 07:26:29
![](https://img.aspxhome.com/file/2023/4/50014_0s.png)
如何用Excel表格实现横向筛选
2023-10-19 20:55:39
![](https://img.aspxhome.com/file/2023/4/a154174_0s.jpg)
Win10 Mobile RS1预览版14267.1004 修复Lumia 550充电问题
2022-03-19 19:05:55
![](https://img.aspxhome.com/file/2023/28/a245547_0s.jpg)
钉钉云课堂横屏-钉钉云课堂横屏设置方法
2023-03-02 19:42:28
![](https://img.aspxhome.com/file/2023/3/a292278_0s.jpg)
surface go不支持升级Win11怎么解决?
2023-08-03 07:49:13
![](https://img.aspxhome.com/file/2023/27/a238476_0s.jpg)
windows7为移动设备设置wifi热点(笔记本需开启无线发射接收)
2023-06-05 20:30:53
win10弹出找不到文件怎么办?win10弹出找不到文件的解决方法
2022-01-18 07:02:42
![](https://img.aspxhome.com/file/2023/3/a301234_0s.png)
5.4.1.7 Excel VBA的文本框的HideSelection属性
2023-09-03 16:55:48
如何使用PS整体调整室内照片变成小清新照片?
2023-02-19 14:02:28
![](https://img.aspxhome.com/file/2023/7/a329240_0s.jpg)
QQ号怎么申请注销 QQ号申请注销方法
2023-10-22 13:22:13
![](https://img.aspxhome.com/file/2023/8/a338664_0s.png)