vrvrf_c.exe怎么修复:在WORD中用VBA实现光标移动与内容选择_前进~~
来源:百度文库 编辑:中财网 时间:2024/04/29 14:41:20
在WORD中用VBA实现光标移动与内容选择2008-04-24 14:07 在WORD中如何用VBA宏语言选定一行、一段,删除一行、一段,移动光标至行首、行尾、段首、段尾等。请看以下内容。 Sub MoveToCurrentLineStart()
'移动光标至当前行首
Selection.HomeKey unit:=wdLine
End Sub Sub MoveToCurrentLineEnd()
'移动光标至当前行尾
Selection.EndKey unit:=wdLine
End Sub Sub SelectToCurrentLineStart()
'选择从光标至当前行首的内容
Selection.HomeKey unit:=wdLine, Extend:=wdExtend
End Sub Sub SelectToCurrentLineEnd()
'选择从光标至当前行尾的内容
Selection.EndKey unit:=wdLine, Extend:=wdExtend
End Sub Sub SelectCurrentLine()
'选择当前行
Selection.HomeKey unit:=wdLine
Selection.EndKey unit:=wdLine, Extend:=wdExtend
End Sub Sub MoveToDocStart()
'移动光标至文档开始
Selection.HomeKey unit:=wdStory
End Sub Sub MoveToDocEnd()
'移动光标至文档结尾
Selection.EndKey unit:=wdStory
End Sub Sub SelectToDocStart()
'选择从光标至文档开始的内容
Selection.HomeKey unit:=wdStory, Extend:=wdExtend
End Sub Sub SelectToDocEnd()
'选择从光标至文档结尾的内容
Selection.EndKey unit:=wdStory, Extend:=wdExtend
End Sub Sub SelectDocAll()
'选择文档全部内容(从WholeStory可猜出Story应是当前文档的意思)
Selection.WholeStory
End Sub Sub MoveToCurrentParagraphStart()
'移动光标至当前段落的开始
Selection.MoveUp unit:=wdParagraph
End Sub Sub MoveToCurrentParagraphEnd()
'移动光标至当前段落的结尾
Selection.MoveDown unit:=wdParagraph
End Sub Sub SelectToCurrentParagraphStart()
'选择从光标至当前段落开始的内容
Selection.MoveUp unit:=wdParagraph, Extend:=wdExtend
End Sub Sub SelectToCurrentParagraphEnd()
'选择从光标至当前段落结尾的内容
Selection.MoveDown unit:=wdParagraph, Extend:=wdExtend
End Sub Sub SelectCurrentParagraph()
'选择光标所在段落的内容
Selection.MoveUp unit:=wdParagraph
Selection.MoveDown unit:=wdParagraph, Extend:=wdExtend
End Sub Sub DisplaySelectionStartAndEnd()
'显示选择区的开始与结束的位置,注意:文档第1个字符的位置是0
MsgBox ("第" & Selection.Start & "个字符至第" & Selection.End & "个字符")
End Sub Sub DeleteCurrentLine()
'删除当前行
Selection.HomeKey unit:=wdLine
Selection.EndKey unit:=wdLine, Extend:=wdExtend
Selection.Delete
End Sub Sub DeleteCurrentParagraph()
'删除当前段落
Selection.MoveUp unit:=wdParagraph
Selection.MoveDown unit:=wdParagraph, Extend:=wdExtend
Selection.Delete
End Sub
'移动光标至当前行首
Selection.HomeKey unit:=wdLine
End Sub Sub MoveToCurrentLineEnd()
'移动光标至当前行尾
Selection.EndKey unit:=wdLine
End Sub Sub SelectToCurrentLineStart()
'选择从光标至当前行首的内容
Selection.HomeKey unit:=wdLine, Extend:=wdExtend
End Sub Sub SelectToCurrentLineEnd()
'选择从光标至当前行尾的内容
Selection.EndKey unit:=wdLine, Extend:=wdExtend
End Sub Sub SelectCurrentLine()
'选择当前行
Selection.HomeKey unit:=wdLine
Selection.EndKey unit:=wdLine, Extend:=wdExtend
End Sub Sub MoveToDocStart()
'移动光标至文档开始
Selection.HomeKey unit:=wdStory
End Sub Sub MoveToDocEnd()
'移动光标至文档结尾
Selection.EndKey unit:=wdStory
End Sub Sub SelectToDocStart()
'选择从光标至文档开始的内容
Selection.HomeKey unit:=wdStory, Extend:=wdExtend
End Sub Sub SelectToDocEnd()
'选择从光标至文档结尾的内容
Selection.EndKey unit:=wdStory, Extend:=wdExtend
End Sub Sub SelectDocAll()
'选择文档全部内容(从WholeStory可猜出Story应是当前文档的意思)
Selection.WholeStory
End Sub Sub MoveToCurrentParagraphStart()
'移动光标至当前段落的开始
Selection.MoveUp unit:=wdParagraph
End Sub Sub MoveToCurrentParagraphEnd()
'移动光标至当前段落的结尾
Selection.MoveDown unit:=wdParagraph
End Sub Sub SelectToCurrentParagraphStart()
'选择从光标至当前段落开始的内容
Selection.MoveUp unit:=wdParagraph, Extend:=wdExtend
End Sub Sub SelectToCurrentParagraphEnd()
'选择从光标至当前段落结尾的内容
Selection.MoveDown unit:=wdParagraph, Extend:=wdExtend
End Sub Sub SelectCurrentParagraph()
'选择光标所在段落的内容
Selection.MoveUp unit:=wdParagraph
Selection.MoveDown unit:=wdParagraph, Extend:=wdExtend
End Sub Sub DisplaySelectionStartAndEnd()
'显示选择区的开始与结束的位置,注意:文档第1个字符的位置是0
MsgBox ("第" & Selection.Start & "个字符至第" & Selection.End & "个字符")
End Sub Sub DeleteCurrentLine()
'删除当前行
Selection.HomeKey unit:=wdLine
Selection.EndKey unit:=wdLine, Extend:=wdExtend
Selection.Delete
End Sub Sub DeleteCurrentParagraph()
'删除当前段落
Selection.MoveUp unit:=wdParagraph
Selection.MoveDown unit:=wdParagraph, Extend:=wdExtend
Selection.Delete
End Sub
在WORD表格中( )不能实现光标在单元格之间移动
如何实现VBA在WORD文档里面取值
Excel中用左右箭头移动光标,光标不会动
在Excel中用VBA编写一个程序
请问下在WORD里为何移动向前移动不了光标呢?
在EXCEL里如何实现类似WORD里的通配符的查找功能?如果用VBA实现的话怎么做?
在WORD中,除了移动光标选取表格中文字,还有什么比较简单的方法?
在execl-vba中用什么语句判断一个工作表是空表
在WORD中可以像在PPT中用框选的方式来选择许多文本框后,用光标键移动吗?急...
在word中若要选定整个文档,应将光标移动到文档左侧变成"正常选择"形状,然后( )
为什么在CMOS下无法移动光标
万能五笔在Word中不能跟随光标
Word中用插入艺术字打出来的文字怎么移动
WORD中怎样实现一篇文章中目录与内容的连接?
word中如何实现选择性的在页面上显示页眉或页脚的内容
在word中怎样能实现,点文字链接到本文档相应的内容?
在word里编程(VBA),如何才能屏蔽源代码
关于vba在操纵word时插入图片的问题
在Excel中用Vba写的程序如何做成可安装的应用程序
EXCEL中用VBA编程,如何在打印成PDF文件的时候自动给文件命名?
在Execl中用VBA编程时,怎样添加ADO数据控件
word中运行的vba程序与word是同一个进程吗?
在word中如何在没有光标的地方写字
光标为什么在桌面上快速的左右移动啊 ?