one more short question

J

Junkstyle

Is there a way for a process to call visio, load an SVG file, and save it as
a .VSD or .VDX?

Thanks any insight on this would be GREATLY appreciated.
 
K

Kari Yli-Kuha

Junkstyle said:
Is there a way for a process to call visio, load an SVG file, and save it as
a .VSD or .VDX?

Thanks any insight on this would be GREATLY appreciated.

An example as VBA:

Public Sub SVG2VSD()

Dim ovApp As Visio.InvisibleApp
Dim ovDoc As Visio.Document

Set ovApp = CreateObject("Visio.InvisibleApp")
Set ovDoc = ovApp.Documents.Open("D:\tmp\Drawing1.svg")
ovDoc.SaveAs "D:\tmp\Drawing1.vsd"
ovDoc.Close
ovApp.Quit

End Sub

hth
/C
 
J

Junkstyle

Kari, this works great but is there a way to do it let us say outside of
Visio in a VB win32 app?

I am automatically generating SVG files on the fly but would like them
automatically converted to VSD files on the fly as well. Assume that Visio
is on the machine that is converting them. Can a win32 app command visio to
perform such an operation?

Thanks for your help.
 
K

Kari Yli-Kuha

Junkstyle said:
Kari, this works great but is there a way to do it let us say outside of
Visio in a VB win32 app?

I am automatically generating SVG files on the fly but would like them
automatically converted to VSD files on the fly as well. Assume that Visio
is on the machine that is converting them. Can a win32 app command visio to
perform such an operation?

Yes, the code works also in standard VB .exe.

Just add "Microsoft Visio 11.0 Type Library" in your Project -> References.
Thanks for your help.

/C
 
J

Junkstyle

Thanks Kari. I got it running in vb.exe as well as c# as a windows app. I
very much appreciate your help so if you dont know this next question I still
owe you alot of gratitude.

One thing is I'm trying to implement it under IIS but I keep getting the
exception:

{System.Runtime.InteropServices.COMException} System.Object
"Server execution failed"

code:

Microsoft.Office.Interop.Visio.InvisibleApp ovApp;
Microsoft.Office.Interop.Visio.Document ovDoc;

ovApp = new Microsoft.Office.Interop.Visio.InvisibleApp(); //error: "Server
execution failed"
ovDoc = ovApp.Documents.Open(svgFullPath);
ovDoc.SaveAs("vsdFullPath");
ovDoc.Close();
ovApp.Quit();

Is it possible to have Visio calls run under IIS? Is there a setting I'm
missing?

Thanks
 
K

Kari Yli-Kuha

Junkstyle said:
Thanks Kari. I got it running in vb.exe as well as c# as a windows app. I
very much appreciate your help so if you dont know this next question I still
owe you alot of gratitude.

One thing is I'm trying to implement it under IIS but I keep getting the
exception:

{System.Runtime.InteropServices.COMException} System.Object
"Server execution failed"

Sorry, I'm not familiar with .NET environment.
Perhaps some kind interop soul could help you.

/C
 
J

Junkstyle

I got it. The problem was the IIS account was running under credentials that
have never launched Visio before. So all I had to do was log on with the IIS
credentials onto the server box and launch Visio once, close visio, and it
worked. I think Visio needs to set up some stuff for each user for the
firsttime.

Now I just need to know the bear minumum install that I need to have on the
server to enable this Visio Automation.
 
J

Joseph Burton

Is there anyway you could layout the steps. I'm having the same problem as
you but I have no idea how to log on with IIS credentials.

Thanks!
 

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