"cannot quit Visio" Message

M

MikeBTP

I am opening Visio 2002 (invisibly) then opening several Visio docs in it
from Visual Basic 6.0 using VBA functions then closing each doc then closing
Visio (with App.Quit). Many times (not always) when it tries to Quit I get
this message: "You cannot quit Visio because a program is handling an event
from Visio. If VBA is at a breakpoint, reset VBA, then quit again."

When the user clicks OK to close this message, Visio is still open and can
only be closed through the Task Manager...End Process. There are simple
regsitry settings being made during Document Close and App.Quit but we can't
find what's causing this.

Anybody have any ideas?

Thanks for any help,

Mike
 
C

Chris Roth [ Visio MVP ]

I'm not a "pointer expert", but you must have some objects in the VB6
program that are holding on for dear life. The question is which objects?

Are you setting your VB6 visDoc objects to nothing before they close?
Something like:

Dim WithEvents visDoc as Visio.Document

Sub OpenADoc

set visDoc = Visio.Application.Documents.Add()

End Sub

visDoc_BeforeDocmentClosed ( document as Visio.document)

set visDoc = Nothing

End Sub

You can do the same thing with the application. At the BeforeQuit event, you
can release your VB6 Visio application object.

--

Hope this helps,

Chris Roth
Visio MVP
 
M

MikeBTP

Thanks Chris. I tried this and some other variations on it and can't seem to
get it to work still. So far I haven't been able to nail down what object is
possibly opened or referenced at this pointbut I'm still looking. Thanks for
your suggestion.

Mike
 

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