powershell脚本没有运行来调用excel的宏

时间:2017-11-24 05:31:00

标签: powershell

PowerShell脚本没有运行来调用excel的宏。我把它称为eye share中的活动。有人请帮忙吗?

谢谢和问候, Nutan Kadam

1 个答案:

答案 0 :(得分:1)

Not clear how it is implemented with eye share . But the below code works for 
macro calling ;
 $excel = New-Object -comobject Excel.Application    
    $wbPersonalXLSB = $excel.workbooks.open("$env:USERPROFILE\Application 
                       Data\Microsoft\Excel\XLSTART\PERSONAL.XLSB")
    $FilePath = $csvFile
    $workbook = $excel.Workbooks.Open($FilePath)
    $excel.Visible = $true
    $worksheet = $workbook.worksheets.item(1)
    $excel.Run("PERSONAL.XLSB!your_macro_name")
    $workbook.save()
    $workbook.close()
    $excel.quit()