UEZ

Excel / Outlook COM

42 posts in this topic

#1 ·  Posted (edited)

Is there a way to avoid that the hidden Excel window will be shown when another instance is opened / attached externally?

Example:

#include <Excel.au3>
#include "..\Office\Outlook\OutlookEX.au3" ;adjust this path!

Global $hGUI = GUICreate("Test")
GUISetState()

Global $aField9[2] = [9, $xlTextFormat]
Global $aFieldInfo[1] = [$aField9]
Global $oWorkbook = Null, $oExcel = _Excel_Open(False, False, True, False, True), $oOutlook = _OL_Open()
Global $sWorkbook = @ScriptDir & "\Test.txt", $sExcel = @ScriptDir & "\Test.xlsx"
$oWorkbook = _Excel_BookOpenText($oExcel, $sWorkbook, 2, $xlDelimited, Default, True, ",", $aFieldInfo, ".", Default, Default, 65001)

$iRows = $oWorkbook.ActiveSheet.UsedRange.Rows.Count - 1
$iColumns = $oWorkbook.ActiveSheet.UsedRange.Columns.Count - 1


$oOutlook_Mail = $oOutlook.CreateItem(0)
With $oOutlook_Mail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Test"
    .Attachments.Add($sExcel, 1, 1)
    .Display
EndWith

Do
Until GUIGetMsg() = -3

_OL_Close($oOutlook)
_Excel_Close($oExcel, False, True)

 

When I start the script it will load the comma separated text file hidden in the background, open a new Outlook window and attach an Excel file.

Now, when I double click the attachment in the Outlook window to open the attachment also the hidden Excel window is shown.

How can I avoid that the hidden window is shown?

 

I'm using Office 2013.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites



Can't you close Excel before displaying the mail item?


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

No, the text file opened by Excel is needed to display data according to the selection made by the user.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Maybe

$oExcel.Windows($oWorkbook.Name).Visible = False

after _Excel_BookOpenText does the trick? This is executed when $bVisible is set to False for function _Excel_BookOpen.


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

That's not working because the Excel functions after this trick will not work anymore

Getting an em

A COM error as been triggered
Number is: 80010105
Scriptline is: 292
WinDescription is: The server threw an exception

 

If I'm inserting the line just before the $oOutlook_Mail = $oOutlook.CreateItem(0) then the hidden Excel window will be shown but the content is not visible.

 

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

How many Excel instances are running after the user opened the Excel attachment from the Outlook mail?


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

In this case I'm the user. ;)

 

At the beginning no Excel instances are running.

After starting the script only one instance caused by $oExcel = _Excel_Open(False, False, True, False, True).

Still one instance after text file load

When clicking on the attachment still one Excel instance but two Excel windows are visible now.

 

Excel will be opened with the /dde parameter.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

   Excel will be opened with the /dde parameter.

Can you please describe what that means?


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Another question:
Why does the user need to double click the attachment? Can't you just open the original file?


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Can you please describe what that means?

When I look in the registry how Excel.exe is opened then I see the /dde parameter. I just want to mention it.

 

Another question:
Why does the user need to double click the attachment? Can't you just open the original file?

Don't ask why a user needs to double click on the attachment. Probably because it is there or just want to check the content before sending it.

 

Some more background information. My scripts takes a huge comma separated text file, loads it using Excel, makes several sorting and filtering to display the data.

The user has the option to save the generated output as an Excel file or mail with the attachment.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

I'm sure it's me but I still don't get why you can't close Excel after having done all the processing and before creating the mail.
When the user decides to open the attachment then Excel is started again.


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I'm sure it's me but I still don't get why you can't close Excel after having done all the processing and before creating the mail.
When the user decides to open the attachment then Excel is started again.

Because the hidden Excel holds the data which is used to display the information. The Excel table holds all the rack information for all the coordinates. The user selects the coordinate and my tool displays the rack with all devices.

Neither I cannot show the code nor some data which is not needed to show my problem. Sorry.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

I just tried your example script with AutoIt 3.3.12.0 and Office 2010 on Windos 7 32 bit.
I get two Excel icons in the task bar but can not switch to the hidden worksheet (test.txt).

 

 


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

This code removes one of the two Excel icons but you now no longer can switch to Excel using alt+tab.

#include <Excel.au3>
#include <OutlookEX.au3>

Global $hGUI = GUICreate("Test")
GUISetState()

Global $aField9[2] = [9, $xlTextFormat]
Global $aFieldInfo[1] = [$aField9]
Global $oWorkbook = Null, $oExcel = _Excel_Open(False, False, True, False, True), $oOutlook = _OL_Open()
Global $sWorkbook = @ScriptDir & "\Test.txt", $sExcel = @ScriptDir & "\Test.xlsx"
$oWorkbook = _Excel_BookOpenText($oExcel, $sWorkbook, 2, $xlDelimited, Default, True, ",", $aFieldInfo, ".", Default, Default, 65001)

$iRows = $oWorkbook.ActiveSheet.UsedRange.Rows.Count - 1
$iColumns = $oWorkbook.ActiveSheet.UsedRange.Columns.Count - 1


$oOutlook_Mail = $oOutlook.CreateItem(0)
With $oOutlook_Mail
    ;   .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Test"
    .Attachments.Add($sExcel, 1, 1)
    .Display
EndWith
$oExcel.Windows($oWorkbook.Name).Visible = False
Do
Until GUIGetMsg() = -3

_OL_Close($oOutlook)
_Excel_Close($oExcel, False, True)

 


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks water but the invisible Excel window which will be visible isn't control able anymore until script is closed.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

I think this is caused by the way you call _Excel_Open and set parameter $bInteractive to False.
Try to set this parameter to True.

Global $oWorkbook = Null, $oExcel = _Excel_Open(False, False, True, True, True), $oOutlook = _OL_Open()

 


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Now the Excel windows is control able but also close able which is fatal for the script.

The best solution would be that the Excel instance which will be created as invisible stays invisible. All other solutions are not 100% safe.

 

Thanks.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

The workbook created by _Excel_BookOpenText stays invisible here (I'm running Office 2010).
I use the following stripped down script:

#include <Excel.au3>
#include <OutlookEX.au3>

GUICreate("Test")
GUISetState()

; Excel part
Global $aField9[2] = [9, $xlTextFormat]
Global $aFieldInfo[1] = [$aField9]
Global $sWorkbook = @ScriptDir & "\Test.txt"
Global $sExcel = @ScriptDir & "\Test.xlsx"
Global $oExcel = _Excel_Open(False, False, True, True, True)
Global $oWorkbook = _Excel_BookOpenText($oExcel, $sWorkbook, 2, $xlDelimited, Default, True, ",", $aFieldInfo, ".", Default, Default, 65001)
; Create Outlook mail
Global $oOutlook = _OL_Open()
$oOutlook_Mail = $oOutlook.CreateItem(0)
With $oOutlook_Mail
    ;   .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Test"
    .Attachments.Add($sExcel, 1, 1)
    .Display
EndWith
$oExcel.Windows($oWorkbook.Name).Visible = False
Do
Until GUIGetMsg() = -3
_OL_Close($oOutlook)
_Excel_Close($oExcel, False, True)

So with Office 2013 Excel still displays test.txt and test.xlsx when the user opens the mail attachment?


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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

This seems to work for this snippet of code but not for the complete app. I need to check why...

Thanks.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

It is somehow possible to check whether the Outlook window was closed / Send button was pressed?


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

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

  • Similar Content

    • singbass
      By singbass
      I have an issue with disk space on a server so I wrote a simple little script to check specific directories and save the sizes to an Excel spreadsheet.  For this script, I am still using version 3.3.8.1.  Everything works fine, I just have a question.
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 #ce ---------------------------------------------------------------------------- #include<date.au3> #include<excel.au3> #include<array.au3> $file = FileOpen(@ScriptDir & "\CMScriptDirList.txt", 0) If @error Then Exit ;--folder view still OK $oexcel = _ExcelBookOpen(@ScriptDir & "\CMScriptDirSizesCopy.xlsx") If @error Then Exit ;--folder view now parent folder $excelArray = _ExcelReadSheetToArray($oexcel) $lastrow = $excelArray[0][0] $lastcol = $excelArray[0][1] _ExcelWriteCell($oexcel, _NowCalc(), 1, $lastcol + 1) While 1 $line = FileReadLine($file) If @error Then ExitLoop $size = DirGetSize(StringStripWS($line, 3)) / 1024 / 1024 $iIndex = _ArraySearch($excelArray, $line, 0, 0, 0, 0, 1, 1) If @error Then ContinueLoop _ExcelWriteCell($oexcel, $size, $iIndex, $lastcol + 1) WEnd FileClose($file) _ExcelWriteFormula($oexcel, "=SUM(R2C" & $lastcol + 1 & ":R38C" & $lastcol + 1 & ")", 39, $lastcol + 1) _ExcelWriteFormula($oexcel, "=R39C" & $lastcol + 1 & "/1024", 40, $lastcol + 1) $oexcel.ActiveSheet.columns($lastcol).copy ;used to copy the format of the original last column of the spreadsheet $oexcel.ActiveSheet.columns($lastcol + 1).PasteSpecial(-4122, Default, Default, Default) ;this just pastes the format of the original last column to the new last column $oexcel.ActiveSheet.Range("A1").Select ;select cell A1 just to unselect the entire column from previous command $oexcel.columns.AutoFit ;auto sizes the column width _ExcelBookClose($oexcel, 1) ;save file when closing The script is compiled and sitting is a sub-directory on the server in question. The text file and the spreadsheet that are used are both in this same folder as well.  When I navigate to the folder and run the script by double-clicking on the executable, the process runs but the folder view where I ran the script will go back up one level so when the script completes, I am in the parent folder from where I started.  I have added message boxes throughout the script and have determined that the folder view goes back up one level at some point after the @error check for the file open and before the @error check for the ExcelBookOpen (where the comments are).
      I just wanted to know if someone can tell me why and if there is a way to prevent it. (Note: still using v3.3.8.1 on this machine but slowly converting scripts to v3.3.14.2).
       
       
    • KimberlyJillPereira
      By KimberlyJillPereira
      I am a newbie in AutoIt. May I know what is the code used to expand the width and height of excel cells because I want to insert pictures in the cell.I tried AutoFit but that doesnt work as I cant specify for the width and height. Only for column width I could expand by using .ColumnWidth but for the row I am not able to expand the row? How to do?? What is the code used ??Please help me and thank you.
    • KimberlyJillPereira
      By KimberlyJillPereira
      I am a newbie in AutoIt. May I know what is the code used to expand the width and height of excel cells because I want to insert pictures in the cell.I tried AutoFit but that doesnt work as I cant specify for the width and height. Only for column width I could expand by using .ColumnWidth but for the row I am not able to expand the row? How to do?? What is the code used ??Please help me and thank you.
    • zetaimmersion
      By zetaimmersion
      Hi all. 
      I am trying to do 2 things but i cannot seem to get any traction on how to read/implement this idea.
      Premise: PowerPoint file in C\temp\presentation.pptx that contains on the first slide 2 entries as "<one>" and "<two>" which need to be replaced with "user1" and "user2", then a silent Outlook send mail containing the file with a predefined body and subject.
      I narrowed it down to COM objects as the Office does not like intrusive open AutoIt functions. I installed OLE/COM Object Viewer to understand how to create the commands but i am still stuck. So far i am trying to user water's code but i suck
      COM object i was originally trying to modify
      Dim $oPPT, $oPres $oPPT = ObjCreate("PowerPoint.Application") $oPPT.Visible = True $oPres = $oPPT.Presentations.Read Water's code below (0.1% modified)
      #include <File.au3> #include "PowerPoint.au3" #include <misc.au3> Global $sFile = "C:\temp\presentation.pptx" Global $sString2Search = "<username>", $sString2Replace = "Password", $iReplaceOnce = 1, $sFullLogFile = "C:\temp\pptxlog.txt" _ProcessPpt($sFile) Func _ProcessPpt($sFile) $oApp = _PPT_PowerPointApp() Local $bChange = False Local $oInterface = $oApp.Presentations Local $oPresentation = $oInterface.Open($sFile, False, False, False) If @error Then _FileWriteLog($sFullLogFile, "E Error " & @error & " opening File " & $sFile) Return SetError(1, 0, 0) EndIf ;it does not even open my file and from here not sure how to read the text and replace it EndFunc ;==>_ProcessPpt  
    • Smigacznr1
      By Smigacznr1
      I'm writing Outlook pst cleaner and now I'm stuck. Compiled script is crashing with OS crash message. When I tryied to run script from editor it's exiting itself (mabye it's some type of crash?) always when it's processing on 4-rd pst file. Here is my code:
      #include <OutlookEX.au3> #include <Date.au3> #include <File.au3> #include <Array.au3> _cleanOutlook("Administrator") _cleanOutlook("Admin") Exit Func _cleanOutlook($user) $foldery = "Wiadomości-śmieci#?SPAM#?Junk E-mail#?Elementy usunięte#?Deleted Items" $tab_folderow = StringSplit($foldery, "#?", 1) $tab_pst = _FileListToArrayRec("c:\users\" & $user, "*.pst", 1+4+8, 1, 0, 2) ;~ _ArrayDisplay($tab_pst) For $d = 1 To UBound($tab_pst) -1 Step +1 $outlook = _OL_Open(True) _OL_Close($outlook, True) $outlook = _OL_Open() Local $aStores = _OL_StoreGet($outlook) ;~ _ArrayDisplay($aStores) For $i = 1 to $aStores[0][0] If $aStores[$i][4] = True Then ;~ ConsoleWrite(@CRLF & "zamykam pst 2") _OL_PSTClose($outlook,$aStores[$i][0]) EndIf Next ;~ _OL_PSTAccess($outlook, "C:\Users\Administrator\Desktop\cos.pst") _OL_PSTAccess($outlook, $tab_pst[$d]) ConsoleWrite(@CRLF & $tab_pst[$d]) ;~ $tab_struktury = _OL_FolderTree($outlook, "*", 10) ;~ If @error Then ;~ ContinueLoop ;~ EndIf ;~ _ArrayDisplay($tab_struktury) $tab_ktory_pst = _OL_PSTGet($outlook) ;~ _ArrayDisplay($tab_ktory_pst) For $a = 0 To UBound($tab_ktory_pst) -1 Step +1 If $tab_ktory_pst[$a][2] = $tab_pst[$d] Then ;~ MsgBox(0, "", $tab_ktory_pst[$a][0]) $nazwa_bazy_pst = $tab_ktory_pst[$a][0] EndIf Next ;~ MsgBox(0, "", UBound($tab_folderow)) ;~ _ArrayDisplay($tab_folderow, $tab_pst[$d]) ConsoleWrite(@CRLF & "przed while") $a = 0 While $a < 2 ConsoleWrite(@CRLF & "while 1") For $b = 1 To UBound($tab_folderow) -1 Step +1 ConsoleWrite(@CRLF & "for 1") $tab_struktury = _OL_FolderTree($outlook, $nazwa_bazy_pst) ;~ _ArrayDisplay($tab_struktury, $nazwa_bazy_pst) ;~ $folder = _OL_FolderAccess($outlook, StringTrimLeft($tab_struktury[0], 2) & "\" & $tab_folderow[$b]) $folder = _OL_FolderAccess($outlook, $nazwa_bazy_pst & "\" & $tab_folderow[$b]) ;~ ConsoleWrite(@CRLF & "eeee") If @error Then ;~ MsgBox(0, "", "\\" & $nazwa_bazy_pst & "\" & $tab_folderow[$b] & @CRLF & @error) ConsoleWrite(@CRLF & "przechodze do kolejnego " & $b+1) ContinueLoop EndIf ;~ _ArrayDisplay($folder, $nazwa_bazy_pst) ConsoleWrite(@CRLF & $tab_folderow[$b]) If $tab_folderow[$b] = "Deleted Items" Or $tab_folderow[$b] = "Elementy usunięte" Then ConsoleWrite(@CRLF & "usuwam kosze") _OL_FolderDelete($outlook, $folder[1], 1) _OL_FolderDelete($outlook, $folder[1], 2) _OL_FolderDelete($outlook, $folder[1], 3) _OL_FolderDelete($outlook, $folder[1], 4) ;~ _OL_FolderDelete($outlook, $folder[1], 5) EndIf If $a = 0 Then $tab_maile = "" $data_dzis = @YEAR & "/" & @MON & "/" & @MDAY & " 00:00" ;~ $data_dzis = "2017/01/31 00:00" $data_szukana = _DateAdd("D", "-3", $data_dzis) $tab_maile = _OL_ItemFind($outlook, $folder[1], $olMail, "[Received]<'" & StringReplace($data_szukana, "/", "-") & "'", "", "", "EntryID", "", 1) If @error Then ContinueLoop EndIf ;~ If UBound($tab_maile) > 1 Then ;~ _ArrayDisplay($tab_maile) ;~ EndIf If UBound($tab_maile) > 1 Then For $c = 1 To UBound($tab_maile) -1 Step +1 ;~ ConsoleWrite(@CRLF & "usuwam stare maile") _OL_ItemDelete($outlook, $tab_maile[$c][0], "", False) Next EndIf EndIf Next $a = $a + 1 WEnd ;~ ConsoleWrite(@CRLF & "pokazuje") ;~ $folder[1].Display $olFolderInbox.Display ;~ _OL_PSTClose($outlook, $olFolderInbox) ;~ If @error Then ;~ MsgBox(0, "", @error) ;~ EndIf Local $aStores = _OL_StoreGet($outlook) ;~ _ArrayDisplay($aStores) For $i = 1 to $aStores[0][0] If $aStores[$i][4] = True Then ;~ ConsoleWrite(@CRLF & "zamykam pst 1") _OL_PSTClose($outlook,$aStores[$i][0]) EndIf Next ;_OL_PSTClose($outlook, $folder[1]) _OL_Close($outlook, True) If @error Then MsgBox(0, "", @error) EndIf ConsoleWrite(@CRLF & "zamykam") ProcessWaitClose("outlook.exe", 30) ProcessClose("outlook.exe") Next EndFunc  
      Outlook and OS is updated. I'm usinn OutlooEX in ver. 1.3.1.0
      Any ideas?