简体   繁体   English

在文件打开时禁止MS Word中的对话框警告

[英]suppress dialog warnings in MS Word on file open

I am using OLE Automation in VBA to open several hundred htm files and save them as word doc files. 我在VBA中使用OLE自动化打开几百个htm文件并将它们保存为word doc文件。

Occasionally this dialog shows up: 有时,此对话框会显示:

Linked style sheets are only supported in web format files.  By saving to this format, all links to style sheets will be lost.

I have Application.displayalerts set to false - is there any way to ignore that particular dialog and carry on execution. 我将Application.displayalerts设置为false - 有没有办法忽略该特定对话框并继续执行。

Excel accepts Application.DisplayAlerts = none, Word uses three Long constants: wdAlertsNone, wdAlertsAll and wdAlertsMessageBox. Excel接受Application.DisplayAlerts = none,Word使用三个Long常量:wdAlertsNone,wdAlertsAll和wdAlertsMessageBox。 If you use wdAlertsNone, your code should work ;) 如果你使用wdAlertsNone,你的代码应该工作;)

尝试在调用SaveAs()之前添加此行:

Application.ActiveDocument.OptimizeForWord97 = True

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM