executing VBA macro in Excel from OLE
On 26/03/2019 22:39, Lynn McGuire wrote:
On 3/26/2019 3:01 PM, Adrian Caspersz wrote:
Cool, I got it to work with the following and my macro was run:
PS C:\Users\lmc $E = New-Object -ComObject Excel.Application
PS C:\Users\lmc $workbook = $E.Workbooks.Open("C:\dii\spreadsheet2.xlsm")
PS C:\Users\lmc $E.Run("testmacro")
PS C:\Users\lmc $workbook.save()
PS C:\Users\lmc $workbook.close()
But I could not get Excel to quit:
PS C:\Users\lmc $workbook.quit()
$E.quit() should work.
--
Adrian C
|