1

我正在尝试从 Powershell 运行 Publisher 宏,但在尝试运行宏时出现错误。这是错误:

方法调用失败,因为 [Microsoft.Office.Interop.Publisher.ApplicationClass] 不包含名为“Run”的方法

我已经.run在 powershell 中的发布者对象上看到了该方法的代码。那么,这个方法被删除了吗?我似乎无法在 VBA 文档中找到它。https://docs.microsoft.com/en-us/office/vba/api/publisher.application

该方法在我使用 Excel COM 对象时出现。

$publisher = New-Object -ComObject Publisher.Application
$document = $publisher.Open($labelPath)

$publisher.Run('macro', $arg1, $arg2) #method not found

$document.Close()
$publisher.Quit()
4

0 回答 0