在VB2010服务中打开Word文档 [英] Opening Word document in a VB2010 service

查看:215
本文介绍了在VB2010服务中打开Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我尝试在VB2010服务中打开Word文档.在装有WXP/Word2007的PC上可以正常工作,但是不能在装有W7/Word2010的PC上运行.

这段代码返回"_document=nothing":

Hi there,

I try to open a Word document in a VB2010 service. This works fine on a PC with WXP/Word2007, however it will not run on a PC with W7/Word2010.

This code returns "_document=nothing":

_document = _word.Documents.Open(FileName:=CType(psTemplate, Object), _
 ConfirmConversions:=False, _
 ReadOnly:=True, _
 AddToRecentFiles:=False, _
 PasswordDocument:=String.Empty, _
 PasswordTemplate:=String.Empty, _
 Revert:=False, _
 WritePasswordDocument:=String.Empty, _
 WritePasswordTemplate:=String.Empty, _
 Format:=0)




非常感谢,
Gerard




Many thanks,
Gerard

推荐答案

我不知道确切原因,但是我在Office 2010中也遇到了同样的问题.
解决方法是在应用程序创建和文档打开之间放置一些延迟,或者尝试多次打开文档,直到打开为止.
就试一试吧.希望对您有所帮助.
I don''t know the exact reason, but I have faced the same issue with Office 2010.
The work around is to put some delay between application creation and document open or try opening document multiple times with some delay until it opens.
Just try it. I hope this helps.


这篇关于在VB2010服务中打开Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆