Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Fehler bei $excelobjekt = [Runtime.Interopservices.Marshal]::GetActiveObject('Excel.Application')

$
0
0

Hallo,

ich möchte gern auf eine bereits geöffnete Excelmappe zugreifen und Daten aus einer Zelle lesen. Dafür muss ich mir ja als erstes einmal die bereits gestartete Excel-Instanz holen. Das wollte ich wie folgt machen:

$excelobjekt = [Runtime.Interopservices.Marshal]::GetActiveObject('Excel.Application')

Beim Ausführen erhalte ich allerdings diesen Fehler:

Ausnahme beim Aufrufen von "GetActiveObject" mit 1 Argument(en):  "Vorgang nicht verfügbar. (Ausnahme von HRESULT: 0x800401E3
(MK_E_UNAVAILABLE))"
In C:\Powershell\Excel_lesen.ps1:3 Zeichen:1
+ $xl = [Runtime.InteropServices.Marshal]::GetActiveObject('Excel.Appli ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : COMException

Hat da jemand einen Rat???

Danke

Torsten


Viewing all articles
Browse latest Browse all 2314

Trending Articles



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