Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Windows 8 Powershell and MS Excel 2010

$
0
0

Hi!,

I have received the next error message when I executed a Powershell v3.0 script withMS Excel 2010:

Exception calling "InvokeMember" with "6" argument(s): "Object does not match target type."

At D:\My Scripting Code & Querys\Test.ps1:5 char:1

+ $xlbooks.PSBase.GetType().InvokeMember("Add", [Reflection.BindingFlags]::InvokeM ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : TargetException

The script is the next:

$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)

My locale is en-US but my keyboard is Latinamerican

G.


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>