Jump to content
Queener

Close the entire application of excel

Recommended Posts

Then back to my question from post #18.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I justed tested wih Excel 2010 on Windows 7 64 bit. Works fine.

  • Is there anything special in the Excel workbook like macros etc?
  • Which version of AutoIt do you run?
  • Do you run the 32 or 64 bit version of Excel?
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I justed tested wih Excel 2010 on Windows 7 64 bit. Works fine.

  • Is there anything special in the Excel workbook like macros etc?
  • Which version of AutoIt do you run?
  • Do you run the 32 or 64 bit version of Excel?

Hmm.. No, nothing special, even an empty workbook still has the same result.

AutoIt is latest: v3.3.14.1

Excel 2013 15.0.4737.1000 32-bit

Windows 7 64-bit

 

I've added some checks and my results are further down below

$aProcesses = ProcessList("Excel.exe")
    ConsoleWrite($aProcesses[0][0] & " Excel instance(s) running." & @CRLF)
    ConsoleWrite('Started Processing ' & $file & @CRLF)
    $oExcel = _Excel_Open(False, False, False, False, True)
    $oWorkbook = _Excel_BookOpen($oExcel, $file, True)
    $aOrgArray = _Excel_RangeRead($oWorkbook)
    $oWorkbook = _Excel_BookClose($oWorkbook, False)
    $oExcelClose = _Excel_Close($oExcel, False, True)
    Sleep(2000)
    ConsoleWrite('Finished Processing ' & $file & @CRLF)
    ConsoleWrite('$oExcelClose=' & $oExcelClose & '   |   @error=' & @error & '   |   @extended=' & @extended & @CRLF)
    $aProcesses = ProcessList("Excel.exe")
    ConsoleWrite($aProcesses[0][0] & " Excel instance(s) still running." & @CRLF)

Console result:

0 Excel instance(s) running.
Started Processing C:\Blank Workbook.xlsx
_Excel_Open() triggered
__Excel_CloseOnQuit triggered. $bNewState=True
_Excel_BookOpen() triggered
_Excel_BookClose() triggered
_Excel_Close() triggered. $bForceClose=True
__Excel_CloseOnQuit triggered. $bNewState=Default
__Excel_CloseOnQuit triggered. $bNewState=False
Finished Processing C:\Blank Workbook.xlsx
$oExcelClose=1   |   @error=0   |   @extended=0
1 Excel instance(s) still running.

 

I have also confirmed that this behaviour is unique to having a 32-bit version of Office on a 64-bit version of Windows. Another system that has both 64-bit OS and 64-bit Office appears to work fine. So it's a mixed software architecture issue. Any ideas on how to resolve?

Edited by mpower

Share this post


Link to post
Share on other sites

EDIT: Sorry ignore this post - notified mod to delete - posted wrong information

Edited by mpower

Share this post


Link to post
Share on other sites

Would it be possible to test this with AutoIt 3.3.12.0?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Would it be possible to test this with AutoIt 3.3.12.0?

Just tested with 3.3.12.0 and no change in behaviour. Excel.exe  still remains in Task Manager.

As a sanity check, add #RequireAdmin to script.

Tried with #RequireAdmin also - no change.

 

Edited by mpower

Share this post


Link to post
Share on other sites

@mpower Why not use this?:

Run(@ComSpec & " /c " & 'taskkill /im excel.exe /f /t', "", @SW_HIDE)

 


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

Because ProcessClose would be sufficient to do that, but would not guarantee closing the correct instance.

Also, the point is that it should work, but it appears not to be.

Share this post


Link to post
Share on other sites

I forgot I had Excel installed. I tried it on version 3.3.12.0 and it closes fine for me whether I close the workbook or not, or whether I set $bForceClose to true or false.

Share this post


Link to post
Share on other sites

I forgot I had Excel installed. I tried it on version 3.3.12.0 and it closes fine for me whether I close the workbook or not, or whether I set $bForceClose to true or false.

Are you running 32-bit Office on 64-bit Windows though?

Share this post


Link to post
Share on other sites

I forgot I had Excel installed. I tried it on version 3.3.12.0 and it closes fine for me whether I close the workbook or not, or whether I set $bForceClose to true or false.

You are talking about Excel 2013?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

JohnOne,

would it be possible to test with 3.3.14.1?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks a lot!
We will then know (hopefully) if the problem is Autoit or Excel related.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Tried it a dozen times, it closed just fine on each occasion.

Tried with $bForceClose true and false, and with excel visible and not.

Exactly as I did with 3.3.12.0

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

×
×
  • Create New...