Visio

Bloodstein

Member
Joined
Jul 1, 2003
Messages
10
Hi,

I need to write a few lines of code that opens a particular document in Visio. This is how Im currently doing it:

Dim App As Visio.Application

Try
App = GetObject(, "Visio.Application") Throws exception if no existing Visio.Application
Catch E As Exception
App = CreateObject("Visio.Application")
End Try

Return App

Now, this is not exactly what I want. I want to be able to open Visio and then open the Visio diagram in the application. With the above code, if an existing Visio instance is already there, it opens the application in that Visio instance. I had to do it this way to get around a small problem - If I open Doc1.vsd in Visio and then use MY APPLICATION to open Doc1.vsd, it gives a sharing violation error.

Check if an existing Visio appication is open. If yes, it opens the document in the existing application. If no, it creates a new application and opens the document in the new app. It should not do this. It has to create a new application INDEPENDENT of any open ones and add documents to it.
 
Back
Top