VB.Net Visio Interop .SaveAs method -File not found- error

S

stride51

This is very weird so I'm hoping someone else has ran into this. Very
simply put I have a Visio drawing control hosted in a windows form. I
can load an existing or create a new visio document and then when I go
to use the saveas method it ends with a "File not found" error. I can't
find anything about this and I've searched for hours, plus when I
compile and run on other people's machines here the error doesn't
happen. Also note that even though I get the "File Not Found" error,
the file still saves just fine.

My code is as follows:
Private Sub btnTest2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTest2.Click
Dim oDoc As Visio.Document = dc1.Document 'dc1 is the drawing
control

oDoc.SaveAs("final.vsd")

End Sub
-------------

Again, I think this is a problem with my machine as it doesn't happen
when I compile and run the program elsewhere. It still happens if I run
the compiled version on my machine.

Any ideas anyone?
 
J

JuneTheSecond

When i tested your code, the file saved normally in the personal
shape folder that visio always open for personal shape.
I wonder if your pc has such personal shape folder.
I recommend that you would specify file name with full path,
as it is documented in help of sasveas.
And i wonder if your vb is correctly set up for the drawing control.
Because, i code as "Dim oDoc As Microsoft.Office.Interop.Visio.Document = ..."
in place of " Dim oDoc As Visio.Document = dc1.Document ...."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top