I have an application which opens an Visio file .VSD and copies some jpeg images onto the VSD file. I am using Visio 2013, it works fine with this version but I have another client machine where I have only exe of this application(not complete code base) and has Visio 2010 in that client machine. when I run the application and select the Visio .vsd file, it throw the above subjected error.
Struggling to understand whether problem with exe, code, version or dlls? May I know what could be the fix or some workaround? My code to open the visio application that's where the exception is thrown is below,
Microsoft.Office.Interop.Visio.Application application = new Microsoft.Office.Interop.Visio.Application();
application.Visible = true;
Microsoft.Office.Interop.Visio.Document doc = null;
OpenFileDialog filedg = new OpenFileDialog();
filedg.Title = "Select VSD template file";
filedg.InitialDirectory = @"c:\";
filedg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
filedg.FilterIndex = 2;
filedg.RestoreDirectory = true;
if (filedg.ShowDialog() == DialogResult.OK)
{
LogMessageToFile("Opening Visio template");
if(application == null)
{
LogMessageToFile("Visio application is NULL");
return;
}
LogMessageToFile("Filename" + filedg.FileName);
doc = application.Documents.Open(filedg.FileName);