自动使用 Word 2010 生成文档
该网络应用程序已经在office2007上完成,我需要对其进行转换,以便它可以在office2010中工作。 我能够转换代码的标头生成器部分,但我对文档本身的正文有问题。该代码从“数据”文档复制数据并将其粘贴到生成的文档中。
appword.activewindow.activepane.view.seekview = 0
'set appsel1 = appword.activewindow.selection
set appsel1 = appword.window(filepath).selection -that is the original one
appdoc1.bookmarks("b1").select
appword.selection.insertafter("some text")
appsel1.endkey(6) -the code stops here
appword.selection.insertafter("some other text")
iexplorer 调试器显示错误:需要 appsel1 对象。当我使用 iexplorer 调试器查看其数据时,其数据为“空”而不是“{...}”
谁能告诉我我做错了什么
如果您需要更多代码,请告诉我。
the webapp was already done on office2007 and i need to convert it so it'll work in office2010.
i was able to convert the header generator part of the code but i have problem with the body of the doc itself. the code copy the data from a "data" doc and paste it into the generated doc.
appword.activewindow.activepane.view.seekview = 0
'set appsel1 = appword.activewindow.selection
set appsel1 = appword.window(filepath).selection -that is the original one
appdoc1.bookmarks("b1").select
appword.selection.insertafter("some text")
appsel1.endkey(6) -the code stops here
appword.selection.insertafter("some other text")
the iexplorer debuger says ERROR:appsel1 object required. and when i view its data using the iexplorer debugger its data is "empty" instead of "{...}"
can anyone tell me what i'm doing wrong
if you need more of the code tell me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 MSDN
所以我怀疑您仍然没有选定的文本。
我想知道您是否可以执行 Selection Collapse(wdCollapseStart) 但这只是一个想法。
From MSDN
So I suspect that you still have no selected text.
I wonder if you can do a Selection Collapse(wdCollapseStart) but that's just a thought.