VBA全选word当前页代码

2016-02-19 09:11 11 1 收藏

今天图老师小编要向大家分享个VBA全选word当前页代码教程,过程简单易学,相信聪明的你一定能轻松get!

【 tulaoshi.com - Word教程 】

下面的代码的功能是,全选word文档的当前页,注意,是当前页,即插入条所在的页,而不是全文。

Dim CurrentPageStart As Long, CurrentPageEnd As Long, myRange As Range

Dim Currentpage As Integer, Pages As Integer

On Error Resume Next

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com)

Currentpage = Selection.Information(wdActiveEndPageNumber)

Pages = Selection.Information(wdNumberOfPagesInDocument)

CurrentPageStart = Selection.GoTo(what:=wdGoToPage, Which:=wdGoToNext, Name:=Currentpage).start

If Currentpage = Pages Then

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com)

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环境下使用。

来源:https://www.tulaoshi.com/n/20160219/1589894.html

延伸阅读
标签: Web开发
码一: script function selecturl(){ z=document.body.createTextRange(); z.moveToElementText(selecturlDiv); z.select(); } /script span onmousemove='selecturl()' id=selecturlDivscriptdocument.write(location.href)/script 代码二: script function copyCode(o){o.select();var js=o.createTextRange();js.execCo...
标签: Web开发
jQuery版本:1.3.2 代码如下: html head script src="jquery-1.3.2.min.js" type="text/javascript"/script /head body input type="checkbox" name="chk_list" id="chk_list_1" value="1" /1br / input type="checkbox" name="chk_list" id="chk_list_2" value="2" /2br / input type="checkbox" name="chk_list" id="chk_list_3"...
标签: Web开发
代码如下: script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"/script input type="checkbox" name="checkbox_name[]” id=”checkbox_name_1″ /1br / input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_2″ /2br / input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_3″ ...
标签: 电脑入门
方法1:尽量使用VBA原有的属性、方法和Worksheet函数 由于Excel对象多达百多个,对象的属性、方法、事件多不胜数,对于初学者来说可能对它们不全部了解,这就产生了编程者经常编写与Excel对象的属性、方法相同功能的VBA代码段,而这些代码段的运行效率显然与Excel对象的属性、方法完成任务的速度相差甚大。例如用Range的属性CurrentRegion来返...
标签: Web开发
代码如下: html head script src="jquery-1.3.2.min.js" type="text/javascript"/script /head body input type="checkbox" name="chk_list" id="chk_list_1" value="1" /1br / input type="checkbox" name="chk_list" id="chk_list_2" value="2" /2br / input type="checkbox" name="chk_list" id="chk_list_3" value="3" /3br / i...

经验教程

421

收藏

63
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部