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

  • Thread starter Thread starter Mark.MSDN
  • Start date Start date
M

Mark.MSDN

Guest
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:



static void Main(string[] args)
{
string vis = "F:\\scratch\\visio.vsd";
if (!System.IO.File.Exists(vis))
{
throw new 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();
}
}

Continue reading...
 
Back
Top