3

Word2003を実行しています。

私はWord文書を持っており、そこから他のWord文書を開き、それらを保存して閉じる前にそれらのタスクを実行するマクロを実行します。

Word has insufficent memory. You will not be able to undo this action once it is completed. Do you want to continue?変更の数が多いため、' 'プロンプトを押し続けます。

私はこのエラーを「グーグル」しましたが、これで機能しないように見える次のもの以外は見つかりませんでした:

  • 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
4

1 に答える 1

4

多くの試行錯誤の末、問題を引き起こしていたのはUNDOバッファーでした。

ファイルを処理していたループ内に次の行を配置すると、メッセージが表示されなくなりました。

ActiveDocument.UndoClear
于 2012-12-14T12:16:30.737 に答える