From: Shiv on 17 Mar 2010 09:23 Below Script to automate Excel runs fine if PIA are not installed. $xl=new-object -comObject Excel.Application $file="D:\test\test.csv" $xl.visible = $true $wbk = $xl.Workbooks.Open("$file") $wks = $wbk.worksheets.item(1) $r1=$wks.Range("A1:D1") $r2=$wks.Range("A2:D2") $xl.Union($r1, $r2) If PIa are installed it fails on line $xl.Union($r1, $r2). I determined that it's happening because Windows Powershell is not able to typecast _ComObject to Microsoft.Office.Interop.Excel.Range. Any pointers? thanks.
|
Pages: 1 Prev: Need Help with a cell? Next: Set certain cells to print and others not to print |