Hallo,
bei mir läuft es mit und ohne Parameter!
Läuft evtl. noch eine 2. Instanz die nicht richtig beendet wurde?
Gib einfach mal die Anzahl der Instanzen nach dem Öffnen aus!
AutoIt
#include <Excel.au3>
#include <MsgBoxConstants.au3>
; Open Excel application (force new instance)
Local $oExcel2 = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Close Example", "Error creating the second Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
$aProcesses = ProcessList("Excel.exe")
MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Close Example 2", "Function starts successfully." & @CRLF & @CRLF & $aProcesses[0][0] & " Excel instance(s) running.")
; *****************************************************************************
; Close the Excel instance opened by _Excel_Open
; *****************************************************************************
_Excel_Close($oExcel2)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Close Example 2", "Error closing the Excel application." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Sleep(2000)
$aProcesses = ProcessList("Excel.exe")
MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Close Example 2", "Function ended successfully." & @CRLF & @CRLF & $aProcesses[0][0] & " Excel instance(s) still running.")
Alles anzeigen