Convert Task Custom Functions

So I've been banging my head against the wall trying to figure out why my convert task wouldn't run with the functions I created.

I tested some functions w/in Excel (quick way to test an algorithm, and since it's written in VBA, it should transfer over).

I transferred the functions over, and the task kept failing.

I put "stop" within the convert function, and again, the task failed--didn't bring up the debugger.

I commented out all of my custom function calls and placed "stop" within the code again. The debugger was brought up.

I uncommented my custom function calls and I get a message "ByRef expected"---huh? Why would the task expect my strings to be ByRef when I defined them as string.

in excel I have

<p>'   GetNumPos</p><p>'       Return first instance of a number</p><p>Function GetNumPos(src As String) As Integer</p><p>    For GetNumPos = 1 To Len(src)</p><p>        If Mid(src, GetNumPos, 1) Like "#" Then Exit Function</p><p>    Next</p><p>    GetNumPos = 0   ' no number found</p><p>End Function</p>

I removed the "as string" and the "as integer" and the function ran fine.

<p>'   GetNumPos</p><p>'       Return first instance of a number</p><p>Function GetNumPos(src)</p><p>    For GetNumPos = 1 To Len(src)</p><p>        If Mid(src, GetNumPos, 1) Like "#" Then Exit Function</p><p>    Next</p><p>    GetNumPos = 0   ' no number found</p><p>End Function</p>

So if you're writing custom code w/in the script of Convert Task, remove the "as [data type]" in the function definitions, and see if the task executes.

SolidworksSolidworks Pdm/enterprise Pdm