Word 2003 VBA - 如何禁用“Word内存不足”的警告?

3
我正在使用 Word 2003。
我有一个 Word 文档,从中运行宏以打开其他 Word 文档并在保存和关闭之前对其执行任务。
由于更改的数量,我一直遇到“Word 内存不足。完成此操作后,您将无法撤消此操作。是否要继续?”提示。
我已经通过谷歌搜索了这个错误,但除了以下内容外,没有找到其他信息,而这似乎在这里不起作用:
Application.DisplayAlerts = False Application.DisplayAlerts = wdAlertsNone 我认为这可能是因为该代码适用于运行宏的文档,而不是宏正在处理的文档。
下面的代码是我正在使用的代码的简化版本。我只删除了一些记录函数。
Function open_word_file(file_name)

    Call wd_backup_current_file_first(file_name) ' backup the current file - so that if damage is done, it can be undone.

    Documents.Open FileName:=file_name, ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:=""


    Application.DisplayAlerts = False
    'Application.DisplayAlerts = wdAlertsNone



    '<do_work>
    Call do_something_with_the_opened_file
    '</do_work>

    ActiveDocument.Save ' save the changes
    ActiveDocument.Close
End Function
1个回答

4

经过多次尝试,发现撤销缓冲区引起了问题。

我在处理文件的循环中插入了以下代码行,这条消息就不再显示了。

ActiveDocument.UndoClear

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接