Problem with #task and .sts

Hello,

I am trying to use #Task to export all parts in the folder to *.sat format. When I add my .swp macro to #Task it works perfectly. But I need to set an argument saving location. I am trying to do this by this tutorial​. After setting arguments and saving script to .sts  file type (see attachement) the #Task does not work. It gives me: Generic error. This indicates that task failed to run a macro. Please make sure that you can run macros in solidworks. Anyone knows what I am doing wrong?

This is .swp code that works:

Dim MyPath As String

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim strFilePath As String

Dim lngPathSize As Long

Dim strNewFilePath As String

Dim ret As Boolean

Dim lngPathPos1 As Long

Dim lngPathPos2 As Long

Dim strFileName As String

Dim lngError As Long

Dim lngWarning As Long

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swModelDocExt = swModel.Extension

strFilePath = swModel.GetPathName

lngPathSize = Strings.Len(strFilePath)

lngPathPos2 = Strings.InStrRev(strFilePath, ".", -1, vbTextCompare)

lngPathPos1 = Strings.InStrRev(strFilePath, "\\", -1, vbTextCompare)

strFileName = Strings.Mid(strFilePath, lngPathPos1 + 1, (lngPathPos2 - lngPathPos1) - 1)

MyPath = "D:\\Darbinis katalogas\\Macro\\Bandymam\\SAT"

strNewFilePath = MyPath & "\\" & strFileName & ".sat"

swModelDocExt.SaveAs strNewFilePath, 0, 1, Nothing, lngError, lngWarning

End Sub

Regards

E.P.

SolidworksApi macros