word文档,查找文本框里的内容,找到后如何得到在第几页?vb如何实...
展开全部 word文档,查找多页文本框里的内容,找到后如何得到在第几页?有能直接得到第几页的语句吗?例如在附件中查找文本框里“李四”所在页值。
查找用的语句:With MyRange.Find.Text = “李四”MyRange.Find.Execute.Forward = TrueEnd With我知道,如何查找多页不在文本框里的内容,可以用以下句子得到Set MyRange = ActiveDocument.Content当前页 = MyRange.Information(wdActiveEndPageNumber)...
word vba 用正则表达式查找文字,不改内容只换字体
实现代码如下:Private Sub Worksheet_SelectionChange(ByVal Target As Range)Application.Intersect(Rows(Target.Row), Target.CurrentRegion).SelectTarget.ActivateEnd SubVisual Basic for Applications(VBA)是Visual Basic的一种宏语言,是微软开发出来在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
由于微软Office软件的普及,人们常见的办公软件Office软件中的Word、Excel、Access、Powerpoint都可以利用VBA使这些软件的应用更高效率,例如:通过一段VBA代码,可以实现画面的切换;可以实现复杂逻辑的统计(比如从多个表中,自动生成按合同号来跟踪生产量、入库量、销售量、库存量的统计清单)等。
vba word如何提取当前段落某个字符前的字符
展开全部 可以用下面的代码来实现:Sub mytest()Selection.MoveDown unit:=wdParagraphSelection.MoveUp unit:=wdParagraph, Extend:=wdExtendutxt = Selection.Range.Textupos = InStr(utxt, "、")If upos > 0 Thenut = Left(utxt, upos - 1)MsgBox ut '这里就是要提取的内容ElseMsgBox "没有找到顿号!!!"End IfEnd Sub...
word vba怎样把光标定位到指定字符串的位置?
展开全部 移动光标至文档开始Selection.HomeKey unit:=wdStory下面的供参考:Sub MoveToCurrentLineStart()'移动光标至当前行首Selection.HomeKey unit:=wdLineEnd SubSub MoveToCurrentLineEnd()'移动光标至当前行尾Selection.EndKey unit:=wdLineEnd SubSub SelectToCurrentLineStart()'选择从光标至当前行首的内容Selection.HomeKey unit:=wdLine, Extend:=wdExtendEnd SubSub SelectToCurrentLineEnd()'选择从光标至当前行尾的内容Selection.EndKey unit:=wdLine, Extend:=wdExtendEnd SubSub SelectCurrentLine()'选择当前行Selection.HomeKey unit:=wdLineSelection.EndKey unit:=wdLine, Extend:=wdExtendEnd SubSub MoveToDocStart()'移动光标至文档开始Selection.HomeKey unit:=wdStoryEnd SubSub MoveToDocEnd()'移动光标至文档结尾Selection.EndKey unit:=wdStoryEnd SubSub SelectToDocStart()'选择从光标至文档开始的内容Selection.HomeKey unit:=wdStory, Extend:=wdExtendEnd SubSub SelectToDocEnd()'选择从光标至文档结尾的内容Selection.EndKey unit:=wdStory, Extend:=wdExtendEnd SubSub SelectDocAll()'选择文档全部内容(从WholeStory可猜出Story应是当前文档的意思)Selection.WholeStoryEnd SubSub MoveToCurrentParagraphStart()'移动光标至当前段落的开始Selection.MoveUp unit:=wdParagraphEnd SubSub MoveToCurrentParagraphEnd()'移动光标至当前段落的结尾Selection.MoveDown unit:=wdParagraphEnd SubSub SelectToCurrentParagraphStart()'选择从光标至当前段落开始的内容Selection.MoveUp unit:=wdParagraph, Extend:=wdExtendEnd SubSub SelectToCurrentParagraphEnd()'选择从光标至当前段落结尾的内容Selection.MoveDown unit:=wdParagraph, Extend:=wdExtendEnd SubSub SelectCurrentParagraph()'选择光标所在段落的内容Selection.MoveUp unit:=wdParagraphSelection.MoveDown unit:=wdParagraph, Extend:=wdExtendEnd SubSub DisplaySelectionStartAndEnd()'显示选择区的开始与结束的位置,注意:文档第1个字符的位置是0MsgBox ("第" & Selection.Start & "个字符至第" & Selection.End & "个字符")End SubSub DeleteCurrentLine()'删除当前行Selection.HomeKey unit:=wdLineSelection.EndKey unit:=wdLine, Extend:=wdExtendSelection.DeleteEnd SubSub DeleteCurrentParagraph()'删除当前段落Selection.MoveUp unit:=wdParagraphSelection.MoveDown unit:=wdParagraph, Extend:=wdExtendSelection.DeleteEnd Sub
转载请注明出处51数据库 » word vba获取查找内容
潘邓LV小闲