Hello Lee,
Thanks for your update!
I've seen that script unfortunatly that code doesn't work when you call an
office application.
However there is some example code for this here:
http://www.codeplex.com/psexpect
Also when it comes to Excel you can just treat it as a database and collect
the data that way.
As it is today it's easier to use vbscript while working with Office.
If you have the time to change your culture do a quick test to see what you
have to do in order to get Office working from PowerShell. Compared to
VBscript it's not fun.
Best regards
Patrick
http://ogenstad.net
"Lee Holmes [MSFT]" <leeholm@xxxxxx> wrote in message
news:473b25d6$1@xxxxxx
Quote:
> Check out this script Jeffrey blogged in April of '05 --
> http://blogs.gotdotnet.com/powershel...25/583235.aspx.
>
> --
> Lee Holmes [MSFT]
> Windows PowerShell Development
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "Patrick Ogenstad" <patrick.ogenstad@xxxxxx> wrote in message
> news:0FFDA4F1-9E01-4A4E-AC1F-8E9F8468E2B0@xxxxxx Quote:
>> I'm sure a lot of people would find this useful. Perhaps someone at
>> Microsoft could let us know if this is something which is being
>> addressed?
>>
>> Patrick
>> http://ogenstad.net
>>
>>
>> "Kirk Munro" <sorry@xxxxxx> wrote in message
>> news:%23F9%23FEnIIHA.1184@xxxxxx Quote:
>>>I hope so. It would greatly facilitate sanity testing of localized
>>>scripts. I was looking for this feature in version 1.0 a while ago when
>>>working with localized help information and using PowerShell with the MUI
>>>pack...switching machines/accounts to test various locales is too onerous
>>>when working out the details of a script.
>>>
>>> --
>>> Kirk Munro
>>> Poshoholic
>>> http://poshoholic.com
>>>
>>>
>>> "RichS" <RichS@xxxxxx> wrote in message
>>> news
A2AB100-89B1-4787-82E7-2542DAAA149B@xxxxxx
>>>>I agree that being able to change the culture would be a big help -
>>>>maybe the
>>>> gloabalisation\localisation features will eventually give us that
>>>> --
>>>> 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
>>>>
>>>>
>>>> "Patrick Ogenstad" wrote:
>>>>
>>>>> Hello Richard,
>>>>>
>>>>> Thanks for your response!
>>>>>
>>>>> Ah, yes I remember hearing about that however in other languages you
>>>>> have
>>>>> the ability to change the culture inside the program. (as far as I
>>>>> know that
>>>>> is)
>>>>>
>>>>> Even if the problem is related to Office it would be great if you
>>>>> could
>>>>> change the culture for the current scope in PowerShell.
>>>>>
>>>>> Cheers
>>>>> Patrick
>>>>> http://ogenstad.net
>>>>>
>>>>> "RichS" <RichS@xxxxxx> wrote in message
>>>>> news:6323E08A-290E-45CE-B62D-5ED228C074B9@xxxxxx
>>>>> > Its is really an Excel issue as it fails in the same way if you try
>>>>> > the
>>>>> > call
>>>>> > in a .NET program
>>>>> > --
>>>>> > 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
>>>>> >
>>>>> >
>>>>> > "Patrick Ogenstad" wrote:
>>>>> >
>>>>> >> Hello,
>>>>> >>
>>>>> >> When I saw the CTP I was hoping I would be able to run scripts
>>>>> >> like:
>>>>> >>
>>>>> >> $a = New-Object -comobject Excel.Application
>>>>> >>
>>>>> >> $a.Visible = $True
>>>>> >>
>>>>> >> $b = $a.Workbooks.Add()
>>>>> >> $c = $b.Worksheets.Item(1)
>>>>> >>
>>>>> >> $c.Cells.Item(1,1) = "A value in cell A1."
>>>>> >>
>>>>> >> Though after the "Workbooks.Add()" I get this error message:
>>>>> >>
>>>>> >> Exception calling "Add" with "0" argument(s): "Old format or
>>>>> >> invalid type
>>>>> >> library. (Exception from HRESULT: 0x80028018
>>>>> >> (TYPE_E_INVDATAREAD))"
>>>>> >> At line:1 char:22
>>>>> >> + $b = $a.Workbooks.Add( <<<< )
>>>>> >>
>>>>> >> *Note this is not a new issue, we had this in PowerShell 1.0 too.
>>>>> >>
>>>>> >> The cause is that I'm not using the "en-US" culture, if I change
>>>>> >> the
>>>>> >> culture
>>>>> >> to en-US everything runs fine.
>>>>> >>
>>>>> >> I know there are ways to code around the problem. But in my opinion
>>>>> >> I
>>>>> >> shouldn't have to do this, in almost every example a PowerShell
>>>>> >> script is
>>>>> >> shorter than a VBScript however when it comes to coding against
>>>>> >> Office I
>>>>> >> would prefer using VBScript at the moment.
>>>>> >>
>>>>> >> Is there any chance of seeing this getting into PowerShell 2.0? If
>>>>> >> not is
>>>>> >> there any kind of roadmap or plan as to when or how this might get
>>>>> >> fixed?
>>>>> >>
>>>>> >> Anyway, it's great to see new development with PowerShell!
>>>>> >>
>>>>> >> Best regards
>>>>> >> Patrick
>>>>> >> http://ogenstad.net
>>>>> >>
>>>>>
>>>
>>> >>