I am migrating to Visio 2016 drawing control from Visio 2010. When I save a new file as .vsd outside the main Visio application it is throwing an exception. However, the file is saved on the given location. I save the file as .vsd for backward compatibility. This would affect reloading/opening the same new file and it is throwing an exception. Below snippet works well with Visio 2010.
BOOL Doc::SaveAs(vbPath)
{
success = TRUE;
if (!SUCCEEDED(CVisioDocument::SaveAsEx(vbPath, visSaveAsWS)))
{
success = FALSE;
}
short saveRc=0;
if (!SUCCEEDED(CVisioDocument::Save(&saveRc)))
ASSERT(0);
return success;
}
CVisioDocument::SaveAsEx(vbPath, visSaveAsWS) return "0". It means successfully saved new document.
But after I try, CVisioDocument::Save(&saveRc) throws an exception, because until a document has been saved, the Save method generates an error.
On the other hand, I can save a new document in the main Visio application without any exception. That's file is opening in the main Visio application.
So, Can anyone help with how can I get rid out of the above problem?
What I have tried:
I find out someone has also a similar problem in Visio 2013,
http://visguy.com/vgforum/index.php?topic=4819.0