PowerShell - Invoke VBA function

$xl = new-object -comobject Excel.Application

$source_wb = $xl.workbooks.open($source)
$xl.visible=$false
$type=$xl.GetType()
$ret=$type.InvokeMember("Run",[Reflection.BindingFlags]::InvokeMethod,$null,$xl,$param)
Write-Host $ret
$xl.Quit()

$currentThread.CurrentCulture = $oldci
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($xl)
Remove-Variable xl

 

posted @ 2018-01-31 14:13  h.yl  阅读(161)  评论(0编辑  收藏  举报