Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Microsoft.Office.Interop.Visio.Application.Documents.open throws null reference pointer exception

$
0
0

Sorry for the double post (those of you who follow other forums) but I was unsure which forum to post this question...

I am attempting to open a Visio 2013 document in C#. The source code is pretty simple and I've done this successfully with other office docs (like Powerpoint) My IDE is Visual Studio 2017. The reference I am using in my project is Microsoft.Office.Interop.Visio version 14.0.0.0 (file: 14.0.4756.1000)

The problem is that when the open is called: vsdApp.Documents.Open it farts out an exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred A null reference pointer was passed to the stub. (Exception from HRESULT: 0x800706F4)

I'm really at a loss to explain this one as the code is stupid simple:

staticvoidMain(string[] args)
{string vis = "F:\\scratch\\visio.vsd";if (!System.IO.File.Exists(vis))
    {thrownew Exception("FAIL: Input file does not exist: "+ vis);
    }
    Microsoft.Office.Interop.Visio.Application vsdApp = new Microsoft.Office.Interop.Visio.Application();
    vsdApp.Visible = false;
    Microsoft.Office.Interop.Visio.Document vsdDoc = vsdApp.Documents.Open( vis );
    vsdApp.Quit();
    }
}


Viewing all articles
Browse latest Browse all 1710

Trending Articles