Excel Re-Starts after shut-down

S

SteveP

I have a VBA in Excel. It runs successfully on a stand alone PC,
reading files, directories, etc on the network.

We recently put it on the webserver, and created a link on a webpage.
The .xls file loads and the program runs fine (it does start slow). I
have an EXIT button where I use ".quit" - the program disappears and
then excel opens on my PC and starts the program over again. I hit EXIT
a second time and it shuts down finally.

When I have Program Manager open and the web brower is running the
application - it does not show Excel as an open application.

When it re-starts of course Excel shows.

The program opens several workbooks and collects information into
arrays that are used to populate a userform.

This is the code for EXIT button:

Private Sub ExitButton_Click()
Dim xlApp As Excel.Application
Set xlApp = GetObject(, "Excel.application")
xlApp.Visible = True
xlApp.Quit
Set xlApp = Nothing
End Sub
 
K

Kim Greenlee

Steve,

I'm still thinking about why you're seeing the behavior on exit that you're
seeing, so no answer for that yet. However...

When you open Task Manager don't look at the Applications page, look at the
Processes page. My guess is that Excel is running as an automated process
and it will show up there. This will also let you know if you are shutting
down Excel properly because you will see instances of Excel collecting there.
(I've only ever been able to have about 8 background Excel processes running
before getting into trouble.)

When cleaning up Excel you have to make sure that you close everything down.
I actually prefer to launch Excel with, what I call, an Excel Controller.
You can find a sample of a .VBS one here:
http://krgreenlee.blogspot.com/2006/04/excel-running-excel-on-windows-task.html

I hope some of this helps.

Kim Greenlee
 
N

NickHK

Steve,
If this is Excel code, then why use GetObject ?
It should work with Application.Quit

You do know MS do not support Office apps used in this server environment ?

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top