如何在VB.Net中找到Microsoft Word Addin 2010中的ActiveDocument.Path和ActiveDocument.Content [英] How to find ActiveDocument.Path and ActiveDocument.Content in VB.Net for Microsoft Word Addin 2010
问题描述
前段时间我使用了一个宏来查找和替换单词。应用程序(Microsoft Word)
dim docPath As String
Dim myRange As Range
docPath = ActiveDocument.Path
设置myRange = ActiveDocument.Content
myRange.Find.Execute FindText:= findString,ReplaceWith:= replaceString,MatchWholeWord:= True,Replace:= wdReplaceAll
i想要实现相同的功能vb.net bacuse我正在使用高级功能(作为目标)创建一个加载项但我似乎无法找到ActiveDocument.Content来设置我的文档范围或ActiveDocument.Path来获取所需文档的路径。
请指导。在此先感谢
I used a macro some time ago to find and replace words. Application(Microsoft Word)
dim docPath As String
Dim myRange As Range
docPath = ActiveDocument.Path
Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:=findString, ReplaceWith:=replaceString,MatchWholeWord:=True, Replace:=wdReplaceAll
i want to achieve same functionality in vb.net bacuse i am making a add-in with advanced features(as target) but i cant seem to find ActiveDocument.Content to set my range of document or ActiveDocument.Path to get the path of required document.
Please guide. Thanks in advance
推荐答案
这里 - 如何:以编程方式定义和选择文档中的范围 [ ^ ] - 你会找到你要找的东西...
Here - How to: Programmatically Define and Select Ranges in Documents[^] - you'll find what you're looking for...
Dim rng As Word.Range = Me.Application.ActiveDocument.Content
更多:
如何使用Visual Basic .NET构建Office COM加载项 [ ^ ]
这篇关于如何在VB.Net中找到Microsoft Word Addin 2010中的ActiveDocument.Path和ActiveDocument.Content的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!