Determing the number of Visio Application instances

S

Scott

Hello,

I am trying to create a printing untility in VBA for some Visio flowcharts I
have but it is important that there is only one instance of Visio running at
the time of execution (of if there is more than one instance running, that I
can also access the other instance(s) as well). Is there any way (i.e.
collection) to determine the number of Visio instances currently running? I
know that the GetObject call will return a reference to an instance of
Visio(granted there is one running) but can that method also be used to
retrieve the other instance(s) as well? If so, how might I go about creating
a collection of the instances of Visio currently running? Any help any of you
can throw my way would be greatly appreciated.

Thanks,

Scott
 
S

Scott

Chris,

Thanks for reply. I have looked over the code and believe it may do some of
what I need in that it may be able to determine if there are mutliple
instances of Visio running. But one piece of information I am lacking is what
the handle for a Visio application is. The code in the link provided is
geared more for Access. It uses the constant hWndAccessApp to signify the
handle for an Access application but I was unable to determine the
constant(if it even exists) for a Visio Application. If I can determine that,
then I can use the code to see if multiple instances of Visio is running and
inform the user to close the other instances before proceeding.

On the other hand, if I was able to retrieve a reference (Visio.Application
Object) to any of the other instances, I would not have to worry about having
the other instances closed before proceeding. Would you, or any one else,
have any thoughts on that?

Thanks,

Scott
 
J

JuneTheSecond

Shell commands return different task ids for instances of Visio.
But nothing can I do after that.
 
C

Chris [Visio MVP]

Seems to me you could just try

set visApp = GetObject("visio.application")

and if anything shows up, then you know that you have at least one app
running, at which point, you can inform the users that they need to shut
other instances down.

The Visio Application object has a WindowHandle32 property. This might help
as well.

- Chris
 

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