Autoit - Closing Excel workbooks.......

06/29/2017 06:24 hutralospi#1
Hello folks,

I have a random 5 excel files named Workbook, Workbook2..... Workbook5 linked to a program. I wish to arrange all of them side by side for comparison. I do this by using shortcut Alt-W-A-V-Enter through Autoit. [ Figure [Only registered and activated users can see links. Click Here To Register...] ]

I wish to close each of the Workbooks WITHOUT saving, using Autoit. I tried to use the following code:

/////////////


/////////////

However, I see that the Windows on the Taskbar are closed, but the actual Workbooks are still present in the desktop and are not closed [ Figure [Only registered and activated users can see links. Click Here To Register...] ] .

I tried using both ProcessClose and WinKill [as in the final lines of the above code - by removing the semi-colons one line at a time]. Using ProcessClose, the Excel program does indeed close, BUT, it does not close 'graciously', that is, when Excel is reopened, the files are prompted for recovery [ on the left side of Figure [Only registered and activated users can see links. Click Here To Register...] ] . Using WinKill too, the Excel program gets closed, but it appears to be Crashing. The program linked to these files (mentioned on the very first line of this post) also crashes due to this excel crash, and stops working.

How do I close each workbook smoothly without saving them? I can press 'n' when prompted for saving.

I have not used the Excel.au3 function yet. (I looked it a little, but unable to deduce anything with my available short time.) Would the above code need it? If so, can you help by using the appropriate calls like _Excel_BookClose or _Excel_Close in the above code?

Thanks for your time.

-Dave

Never mind, solved at [Only registered and activated users can see links. Click Here To Register...] .

Thanks.
07/05/2017 15:10 merquart#2
I know u solved it, but u could use the Excel.au3 and use [Only registered and activated users can see links. Click Here To Register...]