Sign in to follow this  
Followers 0
Mayur

After using _ExcelBookClose function also process EXCEL.exe appears to be running in Task Manager.

16 posts in this topic

Hi All,

I need to read multiple data from excel sheet so for that purpose i open Excel work book using _ExcelBookOpen Then i used _ExcelSheetActivate Function & then _ExcelReadCell & _ExcelBookClose function.

But after execution i found that there are number of EXCEL.exe Processes are running in Task Manager so it slower's the execution time Some times machine gets hang.

Does any one have solution for this problem.

Thanks in Advance,

Mayur

Share this post


Link to post
Share on other sites



Maybe at the end of your session you can use

ProcessClose ( "process")

that kills the exe from the taskman

If, after 1 session you have multiple instances then you can do a loop to check

$check=ProcessExists("EXCEL.exe")

while $check<>0

if ProcessExists("EXCEL.exe") then

ProcessClose("EXCEL.exe")

sleep(10)

endif

$check=ProcessExists("EXCEL.exe")

wend


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

_ExcelBookClose closes the opened workbook but leaves the application running.

Add in your script:

$oExcel.Application.Quit

Where oExcel is the object returned by _ExcelBookOpen

Share this post


Link to post
Share on other sites

Hi, I have the same problem, and does not work any of those functions:

_ExcelBookClose

$oExcel.Application.Quit

I am using MS Excel 2013. I can not use the ProcessClose(excel.exe), becouse there is open more excel documents, whitch is needed and they can not be closed.

what I can do?

Share this post


Link to post
Share on other sites

You need to release the reference to the Excel object in AutoIt too:

$oExcel.Application.Quit
$oExcel = 0

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

 

You need to release the reference to the Excel object in AutoIt too:

$oExcel.Application.Quit
$oExcel = 0

I try this, but no luck :(

Maybe there have to be some order to use this lines? or order does not mater?

i try:

$oxlsServices.ActiveWorkBook.Close
 _ExcelBookClose($oxlsServices,0,0)
 $oxlsServices.Application.Quit
 $oxlsServices = 0
 FileClose($xlsServices)

no luck :(

Share this post


Link to post
Share on other sites

We need more information:

Which Autoit version do you run?

Do you get any error messages?

What's the value of @error after each statement?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

We need more information:

Which Autoit version do you run?

Do you get any error messages?

What's the value of @error after each statement?

AutoIt Version 3.3.6

no error messages at all

@error is = 0

Share this post


Link to post
Share on other sites

3.3.6 is nearly 4 years old. Would you mind to upgrade to 3.3.10.2 or at least 3.3.8.1?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Oh, I'am sorry, this is SciTE-Lite version 3.3.6
AutoIT version is 3.3.10.2

Share this post


Link to post
Share on other sites

Could you please post your script or a reproducer script?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Func SearchForService()
       ;~ ------------------------ Search for service ---------------------------------
         Local $oxlsServices = _ExcelBookOpen($xlsServices, $fVisible)
         $XlsArray = _ExcelReadSheetToArray($oxlsServices) ;Using Default Parameters
         $readSN = String($readSN)
         $readSN = StringStripWS($readSN,8)
         Local $snPos = _ArraySearch($XlsArray, $readSN, 0, 0, 0, 0, 1)
;~       _ArrayDisplay($XlsArray, "Array using Default Parameters")
         If $snPos < 0 Then
            Local $ArrayError
            If @error = 1  Then  $ArrayError = "Array is not an array"
            If @error = 2  Then  $ArrayError = "Array is not a 1 or 2 dimensional array"
            If @error = 3  Then  $ArrayError = "Array is empty"
            If @error = 4  Then  $ArrayError = "$iStart is greater than $iEnd"
            If @error = 6  Then  $ArrayError = "Value was not found in array"
            If @error = 7  Then  $ArrayError = "Array has too many dimensions"
;~          MsgBox(0, "Not Found", $readSN & ' was not found.       $snPos: ' & $snPos & " Error: " & $ArrayError)
            GUICtrlSetData($ServiceBox,"SN: " & $readSN & ' - no service found in the "Warranty_services.xls" file')
            GUICtrlSetBkColor($ServiceBox,0xEEEEEE)
            GUICtrlSetFont($ServiceBox, 9, 700) ; text bold
         Else

            GUICtrlSetData($ServiceBox,"SN:"& $readSN & " has a service: " & @CRLF& _
            $XlsArray[$snPos][4] &@CRLF & _
            "PN: "& $XlsArray[$snPos][2] & @CRLF& _
            "Warranty from: "& $XlsArray[$snPos][8] & @CRLF & _
            "Warranty to: " & $XlsArray[$snPos][9] & @CRLF & _
            "RF LOT NR: "& $XlsArray[$snPos][5] & @CRLF & _
            "Project name: "& $XlsArray[$snPos][6] & @CRLF& _
            "Contract Nr: "& $XlsArray[$snPos][7] & @CRLF)

;~          MsgBox(0, "Found", $readSN & " was found in the array at position " & $snPos)
            GUICtrlSetBkColor($ServiceBox, 0xFF9999)   ;Background color red
            GUICtrlSetFont($ServiceBox, 9, 700) ; text bold
         EndIf
         _ExcelBookClose($oxlsServices,0,0)
         MsgBox(0,"1",@error)
         $oxlsServices.ActiveWorkBook.Close
         MsgBox(0,"2",@error)
         $oxlsServices.Application.Quit
         MsgBox(0,"3",@error)
         $oxlsServices = 0
         MsgBox(0,"4",@error)
         FileClose($xlsServices)
         MsgBox(0,"5",@error)
      ;~ ------------------------ end Search for service ---------------------------------
   EndFunc

Here is the part of the code. I think this will be enough. This program is searching the device warranty information stored in excel file.

Share this post


Link to post
Share on other sites

As all processing is being done in the subroutine the Excel object should be released when you quit the function.

How often do you call this function?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

As all processing is being done in the subroutine the Excel object should be released when you quit the function.

How often do you call this function?

One or two times. This depends on which button is pressed. But mostly only one time. I have noticed, that sometimes excel.exe process closes only after few minutes, but not immediately. I can close the whole program, but excel process closes only after a some time.

Share this post


Link to post
Share on other sites

I have found the solution. It's strange, but when I add Sleep(100) after _ExcelBookOpen line, everything works fine! now excel.exe process closes imeediatly.
Thanks everyone! :)

Share this post


Link to post
Share on other sites

I once had a similar problem with Microsoft Word when there was an improper coded AddIn that was atuomatically started at open time.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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