Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - pshell, vista & office 2007

Reply
 
Old 03-11-2007   #11 (permalink)
Adam Geras


 
 

RE: pshell, vista & office 2007

Entering the conversation late, but you can also use reflection and pass in
'en-US' culture as a parameter ... see DataLib.ps1 from PSExpect for what I
did with Excel for data-driven testing with PowerShell
(http://www.codeplex.com/psexpect).

"RichS" wrote:

> 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
Old 03-12-2007   #12 (permalink)
RichS


 
 

RE: pshell, vista & office 2007

To draw a close to this one - it turns out that the Office 2007 MUI won't be
available until later in the year. Picking up on Adams post I finally got
this to work

$xl = New-Object -comobject "excel.application"
$xl.visible = $true
$xlbooks =$xl.workbooks
$newci = [System.Globalization.CultureInfo]"en-US"
$xlbooks.PSBase.GetType().InvokeMember("Add",
[Reflection.BindingFlags]::InvokeMethod, $null, $xlbooks, $null, $newci)

Thanks Adam I'd been really struggling with the last bit.
--
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


"Adam Geras" wrote:

> Entering the conversation late, but you can also use reflection and pass in
> 'en-US' culture as a parameter ... see DataLib.ps1 from PSExpect for what I
> did with Excel for data-driven testing with PowerShell
> (http://www.codeplex.com/psexpect).
>
> "RichS" wrote:
>
> > 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
Reply

Thread Tools


Similar Threads
Thread Forum
office 2007 files and acounts from disk image to new install of office 2007. Vista General
Vista- Office 2007 and Microsoft Office Outlook Vista mail
Problem with Vista/Office 2007 & SharePoint 2007 Vista networking & sharing
Q&A: Microsoft Office Accounting Express 2007 and Office Accounting Professional 2007 Build ‘Onramp’ to Internet Economy for Small Businesses Vista News
Q&A: Microsoft Office Accounting Express 2007 and Office Accounting Professional 2007 Build ‘Onramp’ to Internet Economy for Small Businesses Vista News


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46