Hi, I have to write a method that Save, Close and Re-Open an Excel Application. The attached code have two bugs:
p.s. i am sorry i don't find the tag to write the code in the message bungle77 - Mon May 20 11:13:22 EDT 2013 |
Re: Close and Re-Open Excel Application Don't know about Excel, but this works for Word:
-Louie |
Re: Close and Re-Open Excel Application llandale - Mon May 20 13:51:18 EDT 2013 Don't know about Excel, but this works for Word:
-Louie it doesn't work i was able to fix the first problem like this
OleAutoObj objExcelWorkbooks = null
i still have the problem i can't kill the Excel application Attachments provaExcel.dxl |
Re: Close and Re-Open Excel Application bungle77 - Tue May 21 05:09:40 EDT 2013 it doesn't work i was able to fix the first problem like this
OleAutoObj objExcelWorkbooks = null
i still have the problem i can't kill the Excel application Your code seems to work. When there is no "Excel.exe" running (as per task Manager), the code ends up with exactly one "excel.exe" running and one workbook displayed. I notice that temporarily there are two "excel.exe" displayed, but that is a feature of taskmanager update rate. I notice that when you run the code twice; the 1st time you get a new sheet "aaa", the 2nd time a new sheet "Sheet4", which cannot be renamed becase "aaa" already exists. Your "Workbooks" loop starting at line #70 doesn't feel right; you can save and close individual worksheets in excel? I think you are getting errors and don't know it. I suggest you add this function:
Then surround your "oleMethod"/"oleGet"/"olePut" calls with the call:
-Louie
|