Script to open Excel spreadsheet and run VBA code using Powershell.
$excel = New-Object -comobject Excel.Application
#open file
$FilePath = 'File Path'
$workbook = $excel.Workbooks.Open($FilePath)
#make it visible (just to check what is happening)
$excel.Visible = $true
#access the Application object and run a macro
$app = $excel.Application
$app.Run(SpreadsheetName.xlsm!Module1.SubName")
#close without saving
$workbook.close($false)
$excel.Quit()
exit