View Single Post
Old 03-11-2007   #9 (permalink)
RichS


 
 

RE: pshell, vista & office 2007

OK - think I've cracked it.

have a look at this KB article

http://support.microsoft.com/default...b;en-us;320369

The problem is the culture the machine is set to. I'm in the UK so have
en-GB - that clashes with Excel's en-US so won't work. I've chnaged all my
location info to US and it now works. $host.currentculture shows en-US

the code

$xl = New-Object -comobject "excel.application"
$xl.workbooks.add()

now works. Brandon - I think you are US based so thats why it worked.

Fix is to install MUI pack or to modify code in KB article for powershell.
Easiest is to use MUI

--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"RichS" wrote:

> Done a bit of digging and found this
>
> http://forums.microsoft.com/MSDN/Sho...68710&SiteID=1
>
> look at the bottom posting in the thread. I'm just going to test it
> --
> Richard Siddaway
> Please note that all scripts are supplied "as is" and with no warranty
> Blog: http://richardsiddaway.spaces.live.com/
> PowerShell User Group: http://www.get-psuguk.org.uk
>
>
> "n3llyb0y" wrote:
>
> > Hi All,
> >
> > I've recently moved to Vista but one of my scripts that was using
> > office 2007 no longer wants to work. I was hoping someone could shed
> > some light on this.
> >
> > I'm calling the excel application
> >
> > $xl = new-object -comobject "excel.application"
> >
> > Then try to add a new workbook
> >
> > $xl.workbooks.add()
> >
> > and get this error:
> >
> > Exception calling "Add" with "0" argument(s): "Old format or invalid
> > type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
> >
> > any ideas?
> >
> > Cheers,
> > Neil
> >
> >

My System SpecsSystem Spec