Sign in to follow this  
Followers 0
guiAI

Hanging process EXCEL.EXE

12 posts in this topic

#1 ·  Posted (edited)

Can't find any effective solution in the forum, except:

ProcessClose("excel.exe")

Any idea? Thanks.

Edited by guiAI

guiAI

Share this post


Link to post
Share on other sites



A little example:

#include <Excel.au3> 
$oExcel = _ExcelBookNew(0) 
_ExcelWriteCell($oExcel, "Some text", 3, 2) 
_ExcelBookSaveAs($oExcel, @DesktopDir & "\Test.xls", "xls", 0, 1) 
_ExcelBookClose($oExcel) 
MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager")

Until the Exit, process is hanging.


guiAI

Share this post


Link to post
Share on other sites

A little example:

#include <Excel.au3> 
$oExcel = _ExcelBookNew(0) 
_ExcelWriteCell($oExcel, "Some text", 3, 2) 
_ExcelBookSaveAs($oExcel, @DesktopDir & "\Test.xls", "xls", 0, 1) 
_ExcelBookClose($oExcel) 
MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager")

Until the Exit, process is hanging.

This works

#include <Excel.au3>

$oExcel = _ExcelBookNew(0)

_ExcelWriteCell($oExcel, "Some text", 3, 2)

_ExcelBookSaveAs($oExcel, @DesktopDir & "\Test", "xls", 0, 1)

_ExcelBookClose($oExcel)

MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager")

REB


MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites

OR

DllCall("User32.dll", "int", "EndTask", "hwnd", WinGetHandle("EXCEL"), "int", 0, "int", 1)

Share this post


Link to post
Share on other sites

This works

#include <Excel.au3>

$oExcel = _ExcelBookNew(0)

_ExcelWriteCell($oExcel, "Some text", 3, 2)

_ExcelBookSaveAs($oExcel, @DesktopDir & "\Test", "xls", 0, 1)

_ExcelBookClose($oExcel)

MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager")

This does not work for me: process EXCEL.EXE still running when MsgBox appears.

guiAI

Share this post


Link to post
Share on other sites

That is because you just close the wbook and not excel.

Put one

$oExcel.Quit
before the msgbox.

Share this post


Link to post
Share on other sites

That is because you just close the wbook and not excel.

Put one

$oExcel.Quit
before the msgbox.

Unfortunately your suggestion does not work for me (Excel 2007). Trying:

#include <Excel.au3> 
$oExcel = _ExcelBookNew(0) 
_ExcelWriteCell($oExcel, "Some text", 3, 2) 
_ExcelBookSaveAs($oExcel, @DesktopDir & "\Test", "xls", 0, 1) 
_ExcelBookClose($oExcel) 
$oExcel.Quit 
MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager")

process EXCEL.EXE is still running when MsgBox appears.


guiAI

Share this post


Link to post
Share on other sites

Try this one.It works for me:

$oExcel.Application.Quit
$oExcel=""

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

#include <Excel.au3>
$oExcel = _ExcelBookNew(0)
_ExcelWriteCell($oExcel, "Some text", 3, 2)
_ExcelBookSaveAs($oExcel, @DesktopDir & "\Test", "xls", 0, 1)
_ExcelBookClose($oExcel)
$oExcel.Quit
MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager")

I'v tested the code with excel 2003 running on windows xp-sp3.

It works! >_<

[[EDIT; added tested code ]]

Edited by Scriptonize

If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

#include <Excel.au3>
$oExcel = _ExcelBookNew(0)
_ExcelWriteCell($oExcel, "Some text", 3, 2)
_ExcelBookSaveAs($oExcel, @DesktopDir & "\Test", "xls", 0, 1)
_ExcelBookClose($oExcel)
$oExcel = ""
MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager")

SOLVED.

Thanks Juvigy.

Edited by guiAI

guiAI

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0