Check return value of macro enabled visio file RRS feed

  • Question

  • Hi,

    I have a C# application, which opens a macro enabled visio document using

    visioApp.Documents.Open() statement. 

    The problem I have is sometimes, application execution stops at the Open() statement since Visio is not responding. I can't figure out a way for the application execution coming out of the open statement. Is there a timeout or an exception I can trap?

    I would really appreciate if anyone can help. I am not able to make progress due to this issue.

    Thanks in advance,


    Tuesday, April 14, 2015 10:11 AM

All replies

  • Hello,

    What parameters do you pass to the Open method?

    Also I always recommend breaking the chain of calls and declaring each property or method call on separate lines. Thus, you can find what method or property exactly caused the issue.

    Tuesday, April 14, 2015 2:08 PM
  • Hi KKailasmoni,

    Are you able to open the document manually? If not, it seems the issue maybe relative to the file. I suggest that you check whether the file is corrupted.

    I also made a quick demo for your test, please create a new macro enable visio file and replace the file in code below:

     public void Main()
                Application visioApp = new Application();
                string fileName = @"C:\Users\UserName\desktop\Drawing1.vsdm";
                visioApp.Visible = true;
                Document doc=visioApp.Documents.Open(fileName);
    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href=""> HERE</a> to participate the survey.

    Thursday, April 16, 2015 8:09 AM