Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RE: New-Object : Cannot load COM type Excel.Application.

690 views
Skip to first unread message

Bob Landau

unread,
Jun 19, 2009, 6:19:01 PM6/19/09
to

What does this return

Get-WMIObject Win32_ClassicCOMClassSetting | ? {$_.VersionIndependentProgId
-like 'excel.application'}

Assuming this does return information are the paths correct

Can the vbscript method CreateObject instanciate Excel?

"Shyam K" wrote:

> Hi All,
>
> am copying the data from sql server to excel by using power shell.
> when am executing the following power shell script am getting the error
> Error
> ------
> New-Object : Cannot load COM type Excel.Application.
> At line:1 char:17
> + $xl = New-Object <<<< -comobject Excel.Application
>
>
> Power shell script
> ------------------------
> $xl = New-Object -comobject Excel.Application
> $xl.visible=$true
> $workbook = $xl.workbooks.open("F:\DBA\Scripts\Output\Allocation_Usage.xls")
> $sheet = $workbook.worksheets | where {$_.name -eq "Mar 09"}

K@discussions.microsoft.com Shyam K

unread,
Jun 19, 2009, 3:25:01 AM6/19/09
to

OldDog

unread,
Jun 21, 2009, 6:24:05 PM6/21/09
to
On Jun 19, 2:25 am, Shyam K <Shyam K...@discussions.microsoft.com>
wrote:

I get that if I try to run the script on a computer that does not have
Excel installed.
If you are running it on your SQL server, it may not have Excel
installed.

K@discussions.microsoft.com Shyam K

unread,
Jun 23, 2009, 5:43:01 AM6/23/09
to

Hi Bob,

even in VB script also am getting the error.
"Microsoft VBScript runtime error: ActiveX component can't create object:
'Excel.Application'"

we have not installed office.

I need clarification that with out installing office / excel can we use the
excel software.

we are able to create excel file by SSIS.

Bob Landau

unread,
Jun 23, 2009, 3:46:01 PM6/23/09
to

Yes you must have the Office application you wish to automate installed. None
of the Office viewer's do anything other than display the document.

So the next question is what is the end result you are after?

SSIS write out a number of different formats. Unless what you'll be doing is
truely numerically intensive I suspect you can get by writing it out as a XML
or CSV file and working from there.

0 new messages