When embedding an OLEObject (Word/XLS/PDF doc) into Excel via powershell, unable to save that

394 Views Asked by At

When I embedding an OLEObject (Word/XLS/PDF doc) into Excel via powershell, I'm unable to save the excel file (I'd like to save manually, not via PShell - but does not work automatically either). If I insert object like *.txt, png,jpeg - there is no problem with saving the target excel file (both auto and manually saving works).

Any idea? Thanks.

The relevant part of the code is:

$missing=[System.Type]::missing

$excel = New-Object -ComObject Excel.Application
$excel.visible=$true
$wrkbook = $excel.Workbooks.Add()
$wrksheet = $wrkbook.Worksheets.Item(1)
$file = ("link")

  $icon =$wrksheet.OLEObjects().Add($missing,$file,$false,$false,$missing,$missing,$missing,$missing,$missing,$missing,$missing)
0

There are 0 best solutions below