Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 无法运行指定的宏_.net - Fatal编程技术网

.net 无法运行指定的宏

.net 无法运行指定的宏,.net,.net,这是示例代码 wrdApp.Run("Macro1", ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oM

这是示例代码

wrdApp.Run("Macro1", ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
   ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
   ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
   ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
当我试图运行应用程序时,@在上面的一行,它抛出了以下错误

COM异常:无法运行指定的宏

我正在阅读一个模板,然后执行一些操作

请帮帮我

问候

Sarayu找到了

这让我疯狂了好几天。事情是这样的,你打电话来

wrdApp.Run(.... 
但是,在WordApp对象上,宏(可能)正在针对文档执行。Word需要知道ActiveDocument才能执行。因此,在调用wrdApp.Run()之前,请添加以下行:

wrdDoc.Activate()

这解决了我的问题

这不是真的!在
wrdDoc.Activate()之后调用
Application.Run(“DoEvents”)
时,我也有错误