I am trying to integrate Visio 2007 with C# (VS 2012 and windows 7 OS) but I am getting error while running the code
Unable to cast COM object of type 'Microsoft.Office.Interop.Visio.ApplicationClass' to interface type 'Microsoft.Office.Interop.Visio.IVApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000D0700-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
Code snippet :
using IVisio = Microsoft.Office.Interop.Visio;
Inside method
var app = new IVisio.ApplicationClass();
var docs = app.Documents; (Error coming at this point)
var doc = docs.Add("");
var page = app.ActivePage;
var shape0 = page.DrawRectangle(1, 2, 6, 3);
shape0.Text = "Hello World";
I have Microsoft office 2010 installed with Visio 2007 on my machine.
Reference Library : Microsoft.Office.Interop.Visio (tried Microsoft Visio 12 Type Library version 4.12.0.0 (visio 2007) and version 14.0.0.0 (visio 2010) but getting the same error.)
I have removed Office 2010 and visio 2007 , rebooted the machine and installed again the office 2010 and visio 2007 software.This has worked.
I was looking for any another solution other than this.
User contributions licensed under CC BY-SA 3.0