I have a script that exports Visio files to PDF files. This is automatically executed by another script.
When it tries to load an old Visio file I get an error saying, that versions below 11 are not supported.
Is there any way to check the version of the file before this error occurs? As the script is supposed to run in the background I dont want the user to get an error message. The file should just be skipped.
Here is my script:
Imports Aspose.Diagram
Imports System.IO
Module Module1
Sub Main()
Dim sInputFile, sOutputFile As String
Try
Dim sParams() As String = Environment.GetCommandLineArgs
If sParams.Length <> 3 Then
MsgBox("Parameterliste nicht richtig... Abbruch!")
Exit Sub
Else
sInputFile = Replace(sParams(1), "|", " ")
sOutputFile = sParams(2).Replace("|", " ")
End If
Dim Type
Dim File As IO.FileSystemInfo
File = New FileInfo(sInputFile)
Type = File.Extension
Dim oVSD As New Diagram(sInputFile)
If oVSD.Version >= "11" Then
If Type = ".vsdx" Or Type = ".vsd" Then
oVSD.Save(sOutputFile, SaveFileFormat.PDF)
Else
MsgBox("Dies ist keine gültige Visio-Datei.")
Exit Sub
End If
Else
Exit Sub
End If
Catch ex As Exception
MsgBox(ex.Message & vbLf & ex.StackTrace)
End Try
End Sub
End Module