Word的问题...... [英] Problem with Word...

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

问题描述

我有通过vb.net自动化MS Word的问题


我的代码是:


Dim objword作为新的Word.ApplicationClass

尝试

objWord.Documents.Open(letterfile)

objWord.Documents.Item(letterfile).Activate()

Catch

MsgBox(错误 - Word未正常运行 - letterfile ="& letterfile&

vbCrLf&" Error ="& ; Err.Description)

openletter = True

退出功能

结束尝试


这是有效的在安装了Word XP的开发计算机上很好。但是,当安装在另一台PC上时(安装了Word 2000),它会失败并显示

错误对象引用未设置为对象实例。我可以告诉

来自任务管理器的Word已经启动并且正在运行但超出

,我无法解决问题所在。我只是通过使用Windows安装程序项目分发了

应用程序,似乎

分发了一个interop.word库。


我不知道还有什么可以尝试....我假设我在开发机器上有Word XP,任何字代码应该向后兼容。


有什么想法吗?


问候

Simon

I have a problem with automating MS Word through vb.net

My code is :

Dim objword As new Word.ApplicationClass
Try
objWord.Documents.Open(letterfile)
objWord.Documents.Item(letterfile).Activate()
Catch
MsgBox("Error - Word Not running properly - letterfile=" & letterfile &
vbCrLf & " Error = " & Err.Description)
openletter = True
Exit Function
End Try

This works fine on my development machine with Word XP installed. However,
when installed on another PC (with Word 2000 installed) it fails with an
error "Object reference not set to an instance of an object". I can tell
from the task manager that Word has started up and is running but beyond
that I can''t work out what the problem is. I have distributed the
application simply by using the Windows installer project which seems to
distribute an interop.word library.

I don''t know what else to try.... I''m presuming that as I have Word XP on
my development machine that any word code should be backwardly compatible.

Any thoughts?

Regards
Simon

推荐答案

第一个问题是办公室的所有版本是否相同?如果不是它

可能是两级之间的类层次结构发生了变化。

问候 - OHM

Simon Verona写道:
First question is if all the versions of office are the same ?. if not it
may be that the class hierarchy has changed between the two.
Regards - OHM
Simon Verona wrote:
我有通过vb.net自动化MS Word的问题

我的代码是:

Dim objword作为新的Word.ApplicationClass
试试
objWord.Documents.Open(letterfile)
objWord.Documents.Item(letterfile).Activate()
Catch
MsgBox("错误 - Word未正常运行 - letterfile =" & letterfile
& vbCrLf&" Error ="& Err.Description)
openletter = True
退出功能
结束尝试
在安装了Word XP的开发计算机上工作正常。
然而,当安装在另一台PC上(安装了Word 2000)时,它会失败并显示错误对象引用未设置为实例
对象我可以告诉任务管理器Word已启动并且正在运行但超出此范围我无法解决问题所在。
我只是通过使用Windows来分发应用程序。 />安装程序项目似乎分发了一个interop.word库。

我不知道还有什么可以尝试....我假设我有Word
XP在我的开发机器上,任何字代码都应该向后兼容。

任何想法?

问候
Simon
I have a problem with automating MS Word through vb.net

My code is :

Dim objword As new Word.ApplicationClass
Try
objWord.Documents.Open(letterfile)
objWord.Documents.Item(letterfile).Activate()
Catch
MsgBox("Error - Word Not running properly - letterfile=" & letterfile
& vbCrLf & " Error = " & Err.Description)
openletter = True
Exit Function
End Try

This works fine on my development machine with Word XP installed.
However, when installed on another PC (with Word 2000 installed) it
fails with an error "Object reference not set to an instance of an
object". I can tell from the task manager that Word has started up
and is running but beyond that I can''t work out what the problem is.
I have distributed the application simply by using the Windows
installer project which seems to distribute an interop.word library.

I don''t know what else to try.... I''m presuming that as I have Word
XP on my development machine that any word code should be backwardly
compatible.

Any thoughts?

Regards
Simon



-

最诚挚的问候 - OHM


O_H_M {at} BTInternet {dot} com



--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com


不,办公室版本不同......


但是,这是一个在vb6上工作正常的代码端口!我怀疑

因此办公室的东西应该是一样的...


问候

Simon

One Handed Man [OHM#]" < O_H_M {在} BTInternet {点} COM>在留言中写道

news:uk **************** @ tk2msftngp13.phx.gbl ...
No, the versions of office are different...

However, this is a port of code that worked fine on vb6! I suspect
therefore that the office stuff should work the same...

Regards
Simon
"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message
news:uk****************@tk2msftngp13.phx.gbl...
第一个问题是如果所有版本的办公室都一样吗?如果没有它可能是两级之间的类层次结构发生了变化。

问候 - OHM

Simon Verona写道:
First question is if all the versions of office are the same ?. if not it
may be that the class hierarchy has changed between the two.
Regards - OHM
Simon Verona wrote:
我有通过vb.net自动化MS Word的问题

我的代码是:

Dim objword作为新的Word.ApplicationClass
尝试
objWord。 Documents.Open(letterfile)
objWord.Documents.Item(letterfile).Activate()
Catch
MsgBox(错误 - Word无法正常运行 - letterfile ="& letterfile < br&>& vbCrLf&" Error ="& Err.Description)
openletter = True
退出功能
结束尝试

这个工作正常在安装了Word XP的开发计算机上。
然而,当安装在另一台PC上时(安装了Word 2000)它会失败并显示错误对象引用未设置为
的实例对象" ;.我可以告诉任务管理器Word已启动并且正在运行但超出此范围我无法解决问题所在。
我只是通过使用Windows来分发应用程序。 />安装程序项目似乎分发了一个interop.word库。

我不知道还有什么可以尝试....我假设我有Word
XP在我的开发机器上,任何字代码都应该向后兼容。

任何想法?

问候
Simon
I have a problem with automating MS Word through vb.net

My code is :

Dim objword As new Word.ApplicationClass
Try
objWord.Documents.Open(letterfile)
objWord.Documents.Item(letterfile).Activate()
Catch
MsgBox("Error - Word Not running properly - letterfile=" & letterfile
& vbCrLf & " Error = " & Err.Description)
openletter = True
Exit Function
End Try

This works fine on my development machine with Word XP installed.
However, when installed on another PC (with Word 2000 installed) it
fails with an error "Object reference not set to an instance of an
object". I can tell from the task manager that Word has started up
and is running but beyond that I can''t work out what the problem is.
I have distributed the application simply by using the Windows
installer project which seems to distribute an interop.word library.

I don''t know what else to try.... I''m presuming that as I have Word
XP on my development machine that any word code should be backwardly
compatible.

Any thoughts?

Regards
Simon


-
最诚挚的问候 - OHM

O_H_M {at} BTInternet {dot} com



--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com



嗨西蒙,


这看起来像是一个真正的哑巴。问题,所以如果是请原谅我,

但是letterfile实际上是否存在于你正在寻找它的路径中

系统哪个不起作用?我认为它在尝试部分失败了

因为objWord。 。 .Activate?


问候 - OHM

Simon Verona写道:
Hi Simon,

This may seem like a really "Dumb" question, so if it is please forgive me,
but does letterfile actually exists in the path you are looking for it in
the system which does not work ?, I presume it fails in the Try section
because the objWord . . .Activate?

Regards - OHM
Simon Verona wrote:
不,办公室版本不同......

但是,这是一个在vb6上运行良好的代码端口!我怀疑
因此办公室的东西应该是一样的......

西蒙
一个汉语的人[OHM#] < O_H_M {在} BTInternet {点} COM>在
消息新闻中写道:英国**************** @ tk2msftngp13.phx.gbl ...
No, the versions of office are different...

However, this is a port of code that worked fine on vb6! I suspect
therefore that the office stuff should work the same...

Regards
Simon
"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in
message news:uk****************@tk2msftngp13.phx.gbl...
第一个问题是所有版本办公室是一样的吗?如果不是,可能是两级之间的类层次结构发生了变化。

问候 - OHM

Simon Verona写道:
First question is if all the versions of office are the same ?. if
not it may be that the class hierarchy has changed between the two.
Regards - OHM
Simon Verona wrote:
我有通过vb.net自动化MS Word的问题

我的代码是:

Dim objword作为新的Word.ApplicationClass
尝试
objWord。 Documents.Open(letterfile)
objWord.Documents.Item(letterfile).Activate()
Catch
MsgBox(错误 - Word无法正常运行 - letterfile ="&
letterfile& vbCrLf&" Error ="& Err.Description)
openletter = True
退出功能
结束尝试

这个工作正常在安装了Word XP的开发计算机上。
然而,当安装在另一台PC上时(安装了Word 2000)它会失败并显示错误对象引用未设置为
的实例对象" ;.我可以告诉任务管理器Word已启动并且正在运行但超出此范围我无法解决问题所在。
我只是通过使用Windows来分发应用程序。 />安装程序项目似乎分发了一个interop.word库。

我不知道还有什么可以尝试....我假设我有Word
XP在我的开发机器上,任何字代码都应该向后兼容。

任何想法?

问候
Simon
I have a problem with automating MS Word through vb.net

My code is :

Dim objword As new Word.ApplicationClass
Try
objWord.Documents.Open(letterfile)
objWord.Documents.Item(letterfile).Activate()
Catch
MsgBox("Error - Word Not running properly - letterfile=" &
letterfile & vbCrLf & " Error = " & Err.Description)
openletter = True
Exit Function
End Try

This works fine on my development machine with Word XP installed.
However, when installed on another PC (with Word 2000 installed) it
fails with an error "Object reference not set to an instance of an
object". I can tell from the task manager that Word has started up
and is running but beyond that I can''t work out what the problem is.
I have distributed the application simply by using the Windows
installer project which seems to distribute an interop.word library.

I don''t know what else to try.... I''m presuming that as I have Word
XP on my development machine that any word code should be backwardly
compatible.

Any thoughts?

Regards
Simon


-
最诚挚的问候 - OHM

O_H_M {at} BTInternet {dot} com



--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com




-

最诚挚的问候 - OHM


O_H_M {at} BTInternet {dot} com



--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com


这篇关于Word的问题......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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