Hi all,
I have an Excel workbook with 2 modules: OwnMailbox & SharedMailbox. Both modules hold a public sub: OwnMailbox has sub Kickoff, SharedMailbox has sub Kickoff1. I try to start the procedures via PowerShell, however it seems it's not working as expected.
This is working:
This is not working:
I have no idea why the second routine is not working. It looks like all the functions are the same, the mentioned module and sub procedure is correct but still it's not working. I have the feeling it has something to do with the first module or routine which is in a project. In this case it was 'SharedMailbox'.
Thanks for helping!
I have an Excel workbook with 2 modules: OwnMailbox & SharedMailbox. Both modules hold a public sub: OwnMailbox has sub Kickoff, SharedMailbox has sub Kickoff1. I try to start the procedures via PowerShell, however it seems it's not working as expected.
This is working:
Code:
$excel = New-Object -ComObject Excel.Application$excel.Visible = $true
$workbook = $excel.workbooks.open("C:\SaveMail.xlsm")
$xlmodule = $workbook.VBProject.VBComponents.item('SharedMailbox')
$excel.Run('Kickoff1')
$workbook.close($true)
$excel.Quit()
This is not working:
Code:
$excel = New-Object -ComObject Excel.Application$excel.Visible = $true
$workbook = $excel.workbooks.open("C:\SaveMail.xlsm")
$xlmodule = $workbook.VBProject.VBComponents.item('OwnMailbox')
$excel.Run('Kickoff')
$workbook.close($true)
$excel.Quit()
I have no idea why the second routine is not working. It looks like all the functions are the same, the mentioned module and sub procedure is correct but still it's not working. I have the feeling it has something to do with the first module or routine which is in a project. In this case it was 'SharedMailbox'.
Thanks for helping!