Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to kill Excel Instance

Hi,

I have code here to kill Excel Instance, but the process won't ended. Any
sugestion for it ?

btw,I ran my code in MS ACCESS

SUB TEST
Dim oExcel As New Excel.Application
Dim oInvbook As Excel.Workbook
Dim oSheet As Excel.Worksheet


Set oExcel = CreateObject("excel.application")
Set oInvbook = oExcel.Workbooks.Open("\\cd020\db\productionsummar y.xls",
, , , , , , , , True)
Set oSheet =
oExcel.Workbooks("productionsummary.xls").Sheets(" shift_sum2x")

Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
oInvbook.Close

ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing
set oInvbook = nothing
set osheet = nothing
END SUB


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to kill Excel Instance

since you do
Dim oExcel As New Excel.Application

the first time you refer to oExcel, a new instance will be created. You
don't need CreateObject

I would release the variables like this. (and add references to
ActiveWorkbook


Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
set oSheet = nothing
oInvbook.Close
set oInvbook = nothing

oExcel.ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
oExcel.ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing


END SUB

--
Regards,
Tom Ogilvy


"JRudy" wrote in message
...
Hi,

I have code here to kill Excel Instance, but the process won't ended. Any
sugestion for it ?

btw,I ran my code in MS ACCESS

SUB TEST
Dim oExcel As New Excel.Application
Dim oInvbook As Excel.Workbook
Dim oSheet As Excel.Worksheet


Set oExcel = CreateObject("excel.application")
Set oInvbook =

oExcel.Workbooks.Open("\\cd020\db\productionsummar y.xls",
, , , , , , , , True)
Set oSheet =
oExcel.Workbooks("productionsummary.xls").Sheets(" shift_sum2x")

Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
oInvbook.Close

ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing
set oInvbook = nothing
set osheet = nothing
END SUB




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to kill Excel Instance

Tom,

thx for your feedback
but I did it from MS ACCESS
that's why I need to make new instance.
Whenever I set nothing and quit the excel, I still see the instance at the
task manager.
Any idea how can I work it out ?


"Tom Ogilvy" wrote in message
...
since you do
Dim oExcel As New Excel.Application

the first time you refer to oExcel, a new instance will be created. You
don't need CreateObject

I would release the variables like this. (and add references to
ActiveWorkbook


Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
set oSheet = nothing
oInvbook.Close
set oInvbook = nothing

oExcel.ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
oExcel.ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing


END SUB

--
Regards,
Tom Ogilvy


"JRudy" wrote in message
...
Hi,

I have code here to kill Excel Instance, but the process won't ended. Any
sugestion for it ?

btw,I ran my code in MS ACCESS

SUB TEST
Dim oExcel As New Excel.Application
Dim oInvbook As Excel.Workbook
Dim oSheet As Excel.Worksheet


Set oExcel = CreateObject("excel.application")
Set oInvbook =

oExcel.Workbooks.Open("\\cd020\db\productionsummar y.xls",
, , , , , , , , True)
Set oSheet =
oExcel.Workbooks("productionsummary.xls").Sheets(" shift_sum2x")

Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
oInvbook.Close

ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing
set oInvbook = nothing
set osheet = nothing
END SUB






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to kill Excel Instance

I answered the question. Your answer represents you don't understand the
significance of the using the new keyword.

I also highlighted areas that could be causing your problem and suggested
how to fix it. Since you obviously have made no attempt to test the
suggestions, there is little else that can be said.


--
Regards,
Tom Ogilvy

"JRudy" wrote in message
...
Tom,

thx for your feedback
but I did it from MS ACCESS
that's why I need to make new instance.
Whenever I set nothing and quit the excel, I still see the instance at the
task manager.
Any idea how can I work it out ?


"Tom Ogilvy" wrote in message
...
since you do
Dim oExcel As New Excel.Application

the first time you refer to oExcel, a new instance will be created. You
don't need CreateObject

I would release the variables like this. (and add references to
ActiveWorkbook


Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
set oSheet = nothing
oInvbook.Close
set oInvbook = nothing

oExcel.ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
oExcel.ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing


END SUB

--
Regards,
Tom Ogilvy


"JRudy" wrote in message
...
Hi,

I have code here to kill Excel Instance, but the process won't ended.

Any
sugestion for it ?

btw,I ran my code in MS ACCESS

SUB TEST
Dim oExcel As New Excel.Application
Dim oInvbook As Excel.Workbook
Dim oSheet As Excel.Worksheet


Set oExcel = CreateObject("excel.application")
Set oInvbook =

oExcel.Workbooks.Open("\\cd020\db\productionsummar y.xls",
, , , , , , , , True)
Set oSheet =
oExcel.Workbooks("productionsummary.xls").Sheets(" shift_sum2x")

Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
oInvbook.Close

ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing
set oInvbook = nothing
set osheet = nothing
END SUB








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to kill Excel Instance

Sorry I didnt watch that object in from of the active worksheet.
You got it right

Thx a lot

Regards,

Rudy

"Tom Ogilvy" wrote in message
...
I answered the question. Your answer represents you don't understand the
significance of the using the new keyword.

I also highlighted areas that could be causing your problem and suggested
how to fix it. Since you obviously have made no attempt to test the
suggestions, there is little else that can be said.


--
Regards,
Tom Ogilvy

"JRudy" wrote in message
...
Tom,

thx for your feedback
but I did it from MS ACCESS
that's why I need to make new instance.
Whenever I set nothing and quit the excel, I still see the instance at
the
task manager.
Any idea how can I work it out ?


"Tom Ogilvy" wrote in message
...
since you do
Dim oExcel As New Excel.Application

the first time you refer to oExcel, a new instance will be created.
You
don't need CreateObject

I would release the variables like this. (and add references to
ActiveWorkbook


Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
set oSheet = nothing
oInvbook.Close
set oInvbook = nothing

oExcel.ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
oExcel.ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing


END SUB

--
Regards,
Tom Ogilvy


"JRudy" wrote in message
...
Hi,

I have code here to kill Excel Instance, but the process won't ended.

Any
sugestion for it ?

btw,I ran my code in MS ACCESS

SUB TEST
Dim oExcel As New Excel.Application
Dim oInvbook As Excel.Workbook
Dim oSheet As Excel.Worksheet


Set oExcel = CreateObject("excel.application")
Set oInvbook =
oExcel.Workbooks.Open("\\cd020\db\productionsummar y.xls",
, , , , , , , , True)
Set oSheet =
oExcel.Workbooks("productionsummary.xls").Sheets(" shift_sum2x")

Call Locate_file
oSheet.Activate
oExcel.Visible = True
oSheet.Copy
oInvbook.Close

ActiveWorkbook.SaveAs Filename:=vPath & " vfname" & ".xls"
ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing
set oInvbook = nothing
set osheet = nothing
END SUB










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
kill command and excel charles Excel Discussion (Misc queries) 7 August 30th 09 04:02 PM
to kill a excel process han keat Excel Programming 1 July 18th 03 07:32 AM
how to kill excel using a vbscript Harald Staff[_4_] Excel Programming 0 July 17th 03 10:02 PM


All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"