Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Completely unloading excel from vb6. Is there an answer?

Hello,

I know this question has been asked a number of times and i have looked
through google for an answer. However i still have not found an answer to
how to completely unload Excel from vb6 without ctl+alt+delete.
i use the standard code to open an excel doc using late binding
Dim xlapp As Object

Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True

Dim iNew As Integer
Dim iOld As Integer


Dim wb As Workbook
Dim ws As Worksheet

And to close i use this:
xlapp.ActiveWorkbook.Close False




xlapp.Quit
xlapp.UserControl = False

Set ws = Nothing
Set wb = Nothing
Set xlapp = Nothing

Excel still is in the task manager and if you attempt to run the code again
before closing the vb project it will crash each time!! Please Help!!!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Completely unloading excel from vb6. Is there an answer?

Try not closing the file.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Hcoms" wrote in message
...
Hello,

I know this question has been asked a number of times and i have looked
through google for an answer. However i still have not found an answer to
how to completely unload Excel from vb6 without ctl+alt+delete.
i use the standard code to open an excel doc using late binding
Dim xlapp As Object

Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True

Dim iNew As Integer
Dim iOld As Integer


Dim wb As Workbook
Dim ws As Worksheet

And to close i use this:
xlapp.ActiveWorkbook.Close False




xlapp.Quit
xlapp.UserControl = False

Set ws = Nothing
Set wb = Nothing
Set xlapp = Nothing

Excel still is in the task manager and if you attempt to run the code

again
before closing the vb project it will crash each time!! Please Help!!!





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Completely unloading excel from vb6. Is there an answer?

Thanks for the idea , however it still keeps Excel loaded! Any more ideas??
"Bob Phillips" wrote in message
...
Try not closing the file.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Hcoms" wrote in message
...
Hello,

I know this question has been asked a number of times and i have looked
through google for an answer. However i still have not found an answer

to
how to completely unload Excel from vb6 without ctl+alt+delete.
i use the standard code to open an excel doc using late binding
Dim xlapp As Object

Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True

Dim iNew As Integer
Dim iOld As Integer


Dim wb As Workbook
Dim ws As Worksheet

And to close i use this:
xlapp.ActiveWorkbook.Close False




xlapp.Quit
xlapp.UserControl = False

Set ws = Nothing
Set wb = Nothing
Set xlapp = Nothing

Excel still is in the task manager and if you attempt to run the code

again
before closing the vb project it will crash each time!! Please Help!!!







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Completely unloading excel from vb6. Is there an answer?

I don't use vb, do you use any other excel object variables (ranges???) that
need to be reset to nothing?



Hcoms wrote:

Hello,

I know this question has been asked a number of times and i have looked
through google for an answer. However i still have not found an answer to
how to completely unload Excel from vb6 without ctl+alt+delete.
i use the standard code to open an excel doc using late binding
Dim xlapp As Object

Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True

Dim iNew As Integer
Dim iOld As Integer

Dim wb As Workbook
Dim ws As Worksheet

And to close i use this:
xlapp.ActiveWorkbook.Close False

xlapp.Quit
xlapp.UserControl = False

Set ws = Nothing
Set wb = Nothing
Set xlapp = Nothing

Excel still is in the task manager and if you attempt to run the code again
before closing the vb project it will crash each time!! Please Help!!!


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Completely unloading excel from vb6. Is there an answer?

What other code have you got in your routine?

for instance,
Set oWS = oExcel.ActiveSheet

Range("A1").Value = 25
Application.DisplayAlerts = False
Workbooks("Book1").Close

should be

Set oWS = oExcel.ActiveSheet

oWS.Range("A1").Value = 25
oExcel.DisplayAlerts = False
oExcel.Workbooks("Book1").Close

If you do not Explicitly refence the Excel object you will get
Excel will remain referenced even though you close & quit.




Hcoms wrote:

Hello,

I know this question has been asked a number of times and i have looked
through google for an answer. However i still have not found an answer to
how to completely unload Excel from vb6 without ctl+alt+delete.
i use the standard code to open an excel doc using late binding
Dim xlapp As Object

Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True

Dim iNew As Integer
Dim iOld As Integer

Dim wb As Workbook
Dim ws As Worksheet

And to close i use this:
xlapp.ActiveWorkbook.Close False

xlapp.Quit
xlapp.UserControl = False

Set ws = Nothing
Set wb = Nothing
Set xlapp = Nothing

Excel still is in the task manager and if you attempt to run the code again
before closing the vb project it will crash each time!! Please Help!!!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Completely unloading excel from vb6. Is there an answer?

Hcoms,
You say you are using late binding. Then you can't have the references to
"Workbook" & "Worksheet" as you need a reference the Excel library.

For me the above code allows Excel to unload, so the problem is in some of
the code that you have not shown here.

Also .UserControl is read only.

NickHK

"Hcoms" wrote in message
...
Hello,

I know this question has been asked a number of times and i have looked
through google for an answer. However i still have not found an answer to
how to completely unload Excel from vb6 without ctl+alt+delete.
i use the standard code to open an excel doc using late binding
Dim xlapp As Object

Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True

Dim iNew As Integer
Dim iOld As Integer


Dim wb As Workbook
Dim ws As Worksheet

And to close i use this:
xlapp.ActiveWorkbook.Close False




xlapp.Quit
xlapp.UserControl = False

Set ws = Nothing
Set wb = Nothing
Set xlapp = Nothing

Excel still is in the task manager and if you attempt to run the code

again
before closing the vb project it will crash each time!! Please Help!!!





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
Calculator Answer Doesn't Match Excel Answer GwenH Excel Discussion (Misc queries) 3 October 20th 08 10:17 AM
Not Unloading a UserForm Mike[_49_] Excel Programming 1 January 29th 04 11:45 PM
Unloading User Forms? Robert Nicholson Excel Programming 1 October 22nd 03 04:36 PM
Unloading A Form Chrissy[_4_] Excel Programming 1 October 15th 03 02:17 PM
Unloading an Add-In Jack Excel Programming 1 October 1st 03 09:39 AM


All times are GMT +1. The time now is 01:43 AM.

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"