Jump to content

Recommended Posts

Posted (edited)

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

ProcessClose("excel.exe")

Any idea? Thanks.

Edited by guiAI

guiAI

Posted

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

Posted

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

Posted

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

Posted

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

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

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...