Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel automation fails from PowerShell when PIa are installed.

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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add-In Automation Fails in Excel 2000 Dave Peterson Excel Programming 3 February 10th 09 01:00 AM
Excel and PowerShell AFD at FONO[_2_] Excel Discussion (Misc queries) 0 October 18th 08 12:06 AM
Excel fails to open workbook using Automation from VB 6 Lowell Excel Programming 0 September 8th 05 05:33 AM
What needs to be installed on the server for excel automation? Hyperactive Excel Programming 1 July 27th 05 03:51 PM


All times are GMT +1. The time now is 03:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"