我想从Powershell ISE打电话给我2个vba潜艇;我可以成功调用wordsub,但调用wordsub1parameter不会触发msgbox并且日志中没有错误:
Sub wordsub()
MsgBox ("hello from sub")
End Sub
Sub wordsub1parameter(greetings)
MsgBox (greetings)
End Sub
Powershell脚本:
$file = "C:\test\test.docx"
$Word = New-Object -ComObject Word.Application
$Word.Visible = $True
$Document=$Word.documents.open($file)
$Word.run("wordsub")
$Word.run("wordsub1parameter", "hello")
这不可能吗?