Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_ExcelClosebook not closing excel process


  • Please log in to reply
2 replies to this topic

#1 kareldezutter

kareldezutter

    Seeker

  • New Members
  • 1 posts

Posted 08 November 2011 - 01:43 PM

I have an autoit script which runs fine but it does not seem to close of the actual excel process. When going to the task manager the excel.exe is still running. I am using Windows 7 and MS Excel 2003.

I also found an other post concerning the same topic but this did not bring a solution either
http://www.autoitscript.com/forum/topic/89786-excelclosebook-not-closing-excel-process/

Here my script:
Plain Text         
  TraySetToolTip("3M Datei suchen...")   $search = FileFindFirstFile("\\9.165.152.39\Lu_Erfurt\TeamReports\3M\" & @YEAR & "\" & @MON & "\*.xls")   If $search <> -1 Then    $all=""    While 1     $file = FileFindNextFile($search)     If @error Then ExitLoop     $all=$all & $file & @CRLF    WEnd    FileClose($search)    $gefunden=0    For $tag=@MDAY to 1 step -1     if $tag<10 then $tag="0" & $tag     $3mtag="3M" & $tag & @mon & stringright(@year,2) & ".xls"     if StringInStr($all,$3mtag)>0 then      $gefunden=1      ExitLoop     EndIf    Next    If $gefunden<>0 then     $oExcel = _ExcelBookOpen("\\9.165.152.39\Lu_Erfurt\TeamReports\3M\" & @YEAR & "\" & @MON & "\" & $3mtag,0)     TraySetToolTip("3M-Reporting-Daten kopieren...")     _ExcelSheetActivate($oExcel,"summary")     $zeile=0     $total=""     while $total<>"total"      $zeile=$zeile+1      $total = _ExcelReadCell($oExcel, $zeile, 2)     WEnd     _ExcelSheetActivate($oExcel,"summary_Ger")     $db_de_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_de_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_UK")     $db_uk_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_uk_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_BE")     $db_be_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_be_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_IT")     $db_it_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_it_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_FR")     $db_fr_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_fr_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_AT")     $db_at_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_at_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_SP")     $db_es_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_es_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_CH")     $db_ch_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_ch_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_PT")     $db_pt_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_pt_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_NL")     $db_nl_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_nl_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_Nordics")     $db_no_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_no_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelSheetActivate($oExcel,"summary_PL")     $db_pl_off=_ExcelReadCell($oExcel, $zeile, 4)     $db_pl_han=_ExcelReadCell($oExcel, $zeile, 6)     _ExcelBookClose($oExcel, 0)     $file_3m=FileOpen("db_3m.txt",2)     FileWriteLine($file_3m,$db_de_off & ";" & $db_de_han)     FileWriteLine($file_3m,$db_uk_off & ";" & $db_uk_han)     FileWriteLine($file_3m,$db_be_off & ";" & $db_be_han)     FileWriteLine($file_3m,$db_it_off & ";" & $db_it_han)     FileWriteLine($file_3m,$db_fr_off & ";" & $db_fr_han)     FileWriteLine($file_3m,$db_at_off & ";" & $db_at_han)     FileWriteLine($file_3m,$db_es_off & ";" & $db_es_han)     FileWriteLine($file_3m,$db_ch_off & ";" & $db_ch_han)     FileWriteLine($file_3m,$db_pt_off & ";" & $db_pt_han)     FileWriteLine($file_3m,$db_nl_off & ";" & $db_nl_han)     FileWriteLine($file_3m,$db_no_off & ";" & $db_no_han)     FileWriteLine($file_3m,$db_pl_off & ";" & $db_pl_han)     fileClose($file_3m)     TraySetToolTip("Datei aufs Share kopieren...")     FileCopy("db_3m.txt","db_3m.csv",1)     $3MDate = @YDAY     $3MToolTip = "3M report imported: " & $3mtag ;& @MDAY & "/" & @MON & "/" & @YEAR    EndIf   Else    FileClose($search)   EndIf








#2 Juvigy

Juvigy

    Experimental Drugs Abuser

  • Active Members
  • PipPipPipPipPipPip
  • 1,282 posts

Posted 08 November 2011 - 01:47 PM

$oExcel.Quit
$oExcel=0
Try those 2.

#3 water

water

    ?

  • MVPs
  • 15,774 posts

Posted 08 November 2011 - 02:06 PM

I think it depends on the version of AutoIt you use. Please give the latest beta a try.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users