Can anyone help me how to get this customized PDM convert task to return a 'Success' status? I've edited it so that the main sub reads:
Sub main()
On Error GoTo Fail :
Set FileSystemObj = CreateObject("Scripting.FileSystemObject")
docFileName = "
Dim convertRequested
convertRequested = 0
If (convertRequested = 1) Then
' Get SW interface object
Set swApp = Application.SldWorks
swApp.Visible = True
Convert docFileName
Else
Success = True ' this isn't actually doing anything, trying to figure out how to replace it with something that will cause the task to complete without a failed status
End If
Exit Sub
Fail:
Log "Error while converting file '" & docFileName & "': " & vbCrLf & _
"An unexpected error occurred while executing the generated script. Script syntax error?" & vbCrLf & _
"Error number: " & Err.Number & vbCrLf & _
"Error description: '" & Err.Description & "'" & vbCrLf
In my real application, I'll replace the 'convertRequested = 0' line with some logic, but when I run this simple code, the task fails with a 'no file converted' error. Which is true, nothing is converted, but that's the correct behavior in this case. Does anyone know how to change this?
SolidworksApi/macros