to kill a excel process
Hi all, I want to sent parse the email header and send the info to excel
worksheet. I do this by writing a macro in Outlook to create a excel object. However, I have problem killing the excel process, everytime after I run the macro I have to manually go to task manager to end the process. Could anyone please help me? Thank you!! =) Function array_to_excel() Dim objApp As Application Dim objDL As Object Dim objExcel As Excel.Application Dim objWB As Excel.Workbook Dim objWS As Excel.Worksheet Dim objRange As Excel.Range Dim file_name As String file_name = "E:\excel\email.xls" Set objExcel = new Excel.Application objExcel.Visible = True Set objWB = objExcel.Workbooks.Open(FileName:=file_name) Set objWS= objWB.Worksheets(1) 'do something objWB.Save objExcel.DisplayAlerts = False objWS.SaveAs FileName:=file_name, FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False objWB.Close objExcel.DisplayAlerts = True objExcel.Quit Set objWS = Nothing Set objWB = Nothing Set objExcel = Nothing End Function *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
to kill a excel process
Usually the instance of Excel only remains when there's a
connection of some kind still open. I see you had a Range dim's, make sure that it's set to nothing too. Patrick Molloy Microsoft Excel MVP -----Original Message----- Hi all, I want to sent parse the email header and send the info to excel worksheet. I do this by writing a macro in Outlook to create a excel object. However, I have problem killing the excel process, everytime after I run the macro I have to manually go to task manager to end the process. Could anyone please help me? Thank you!! =) Function array_to_excel() Dim objApp As Application Dim objDL As Object Dim objExcel As Excel.Application Dim objWB As Excel.Workbook Dim objWS As Excel.Worksheet Dim objRange As Excel.Range Dim file_name As String file_name = "E:\excel\email.xls" Set objExcel = new Excel.Application objExcel.Visible = True Set objWB = objExcel.Workbooks.Open(FileName:=file_name) Set objWS= objWB.Worksheets(1) 'do something objWB.Save objExcel.DisplayAlerts = False objWS.SaveAs FileName:=file_name, FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False objWB.Close objExcel.DisplayAlerts = True objExcel.Quit Set objWS = Nothing Set objWB = Nothing Set objExcel = Nothing End Function *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! . |
All times are GMT +1. The time now is 04:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com