Word VBA:如何知道实际保存操作是否完成?
我在使用大型 Word 文档的 Word VBA 中的 Document.SaveAs
方法时遇到问题,似乎保存操作是异步的,即。调用.SaveAs
后,它会立即返回,但对于大型Word文档,实际保存操作可能尚未完成,而是在另一个线程中进行。
那么我想问的是,是否有办法检测实际保存操作是否正在进行或已完成?
我用Delphi调用Word的自动化接口,如果讨论这个问题有意义的话,但我不这么认为?
I am having a problem with the Document.SaveAs
method in Word VBA with large Word documents, it seems that the save operation is asynchronous, ie. after calling .SaveAs
it returns immediately, but with large Word documents the actual save operation may not has been completed and it's in progress in another thread.
So what I want to ask is that if there is a way to detect if the actual save operation is in progress or finished?
I use Delphi to call the automation interface of Word, if it means something in discussing this problem, but I don't think so?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
办公自动化的 saveas 是进程外调用,因此它将始终在单独的进程上运行,因此本质上是异步的。
实际上没有办法捕获通知,除非它给出异常。
The saveas of the office automation is a out of process call, so it will always run on a seperate process, hence its asynchronous in nature.
There is literally no way to catch the notification unless it gives an exception.
它是:
如果文档之前没有应用
.SaveAs
,您也可以检查.Path
(即If ActiveDocument.Path
> "" 然后 ....
)请注意,后台保存是异步的,而不是您手动调用的保存 - 由
.Saved
检查。It's:
If the document has not had a
.SaveAs
applied against it before, you can check this the.Path
as well (i.e.If ActiveDocument.Path <> "" Then ....
)Note that it is the Background Save that is asynchronous, not the Save which you invoke manually - that is checked by
.Saved
.