通过自动化捕获错误 [英] Trapping Errors Via Automation

查看:82
本文介绍了通过自动化捕获错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法捕获另一个通过自动化控制

的应用程序中生成的错误?我有一个Access 2000应用程序打开Word 2000并继续

打开一系列文档,并在每个文档中解析内容和

将其写入Access表(打开Word后,Access应用程序在Word中运行一个

宏,通过DAO解析并写入Access应用程序。)


偶尔我们得到一个来自Word的错误(例如文档被锁定以进行
编辑或其他),这会挂起进程。这个过程是一夜之间

一个,所以,显然,如果它是从Word错误消息中挂起的。


是否有办法捕获这些生成的错误消息通过Word然后将
移到下一个文件上?


谢谢,


Neil

Is there a way to trap an error generated in another app that is controlled
via automation? I have an Access 2000 app that opens Word 2000 and proceeds
to open a series of documents and, in each document, parse the contents and
write it to an Access table (the Access app, after opening Word, runs a
macro within Word which parses and writes to the Access app via DAO).

Occasionally we get an error from Word (such as "document is locked for
editing" or other), which hangs the process. The process is an overnight
one, so, obviously, if it hangs from a Word error message.

Is there a way to trap these error messages generated by Word and just move
onto the next document?

Thanks,

Neil

推荐答案

为什么不将Word宏移动到访问VBA代码?

Why not move the Word Macro to Access VBA code?


因为它很可怕我这样做的时候很慢当Word文档

通过管道发送到Access for Access进行解析时,它非常慢。

当我将代码移动到Word宏时,允许Word解析它本身没有

发送到Access,然后让Word写入Access表,它更快(> b $ b更快(虽然它仍然需要相当长的时间)。


但我想我可以从Access打开Word文档,然后只需使用

Word宏来解析它。这可能会奏效。


Neil

Chuck Grimsby < C。******* @ worldnet.att.net>在消息中写道

news:11 ********************** @ o13g2000cwo.googlegr oups.com ...
Because it was hideously slow when I did it that way. When the Word document
was sent through the pipe to Access for Access to parse, it was very slow.
When I moved the code to a Word macro, allow Word to parse it itself without
sending to Access, and then have Word write to an Access table, it was much
faster (though it still takes a fair amount of time).

But I suppose I could open the Word doc from Access and then just use the
Word macro to parse it. That might work.

Neil
"Chuck Grimsby" <c.*******@worldnet.att.net> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
为什么不将Word宏移动到访问VBA代码?
Why not move the Word Macro to Access VBA code?



这是一种非常常见的方法。在Word中写宏,但是通过

调用它来访问自动化,并从通话中返回陷阱错误。


周一,2005年5月9日04:42 :格林尼治标准时间36,尼尔 <无**** @ nospam.net>写道:
That''s a pretty common way to do it. Write the Macro in Word, but call it via
Access automation, and trap errors returned from the call.

On Mon, 09 May 2005 04:42:36 GMT, "Neil" <no****@nospam.net> wrote:
因为当我这样做的时候它非常缓慢。当Word文档通过管道发送到Access for Access进行解析时,它非常慢。
当我将代码移动到Word宏时,允许Word自行解析它没有
发送到Access,然后让Word写入Access表,它更快(虽然它仍然需要相当长的时间)。

但我想我可以打开Word来自Access的doc,然后只使用
Word宏来解析它。这可能会奏效。

Neil

" Chuck Grimsby" < C。******* @ worldnet.att.net>在消息中写道
新闻:11 ********************** @ o13g2000cwo.googleg roups.com ...
Because it was hideously slow when I did it that way. When the Word document
was sent through the pipe to Access for Access to parse, it was very slow.
When I moved the code to a Word macro, allow Word to parse it itself without
sending to Access, and then have Word write to an Access table, it was much
faster (though it still takes a fair amount of time).

But I suppose I could open the Word doc from Access and then just use the
Word macro to parse it. That might work.

Neil
"Chuck Grimsby" <c.*******@worldnet.att.net> wrote in message
news:11**********************@o13g2000cwo.googleg roups.com...
为什么不将Word宏移动到访问VBA代码?
Why not move the Word Macro to Access VBA code?






这篇关于通过自动化捕获错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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