Avatar of mmtcunningham1
mmtcunningham1 asked on

If visio application is already open, how do I close it and start a new one????

 The code I have in place will close the visio application if it is open and start a new application but now my problem is if the user is currently trying to make a change to the file, then my program will crash.  
I get this message:
This file is open for modifications in another instance of Visio.
How can I get around this??
Could I somehow display a message box and ask the user to close the application?
Visual Basic ClassicProgrammingMicrosoft Visio

Avatar of undefined
Last Comment
Ralf Klatt

8/22/2022 - Mon
Ralf Klatt


... I'm not sure which version of Visio you're using ... but have you installed the newest Service Release for Visio?

Having had a look at the related MS-KB-Article, Microsoft offers a work-around at least for Visio 2002 STD and Visio 2002 PRO at http://support.microsoft.com/kb/295691/en-us

Best regards,

I'm using Visio 2007, but the program I'm developing must support Visio 2003.
I'm trying to do the close from a VB application so I'm not sure if the service release will help.
Ralf Klatt


could you please provide the VB.NET code of the related Sub or Function?

Best regards,
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

On Error Resume Next
        VisioApplication = GetObject(, "Visio.Application")
        If Err().Number = 0 Then
            VisioApplication = Nothing
        End If
        On Error GoTo 0
        VisioApplication = CreateObject("Visio.Application")
Ralf Klatt

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question