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
' GetNumPos ' Return first instance of a number Function GetNumPos(src As String) As Integer For GetNumPos = 1 To Len(src) If Mid(src, GetNumPos, 1) Like "#" Then Exit Function Next GetNumPos = 0 ' no number found End Function
I removed the "as string" and the "as integer" and the function ran fine.
' GetNumPos ' Return first instance of a number Function GetNumPos(src) For GetNumPos = 1 To Len(src) If Mid(src, GetNumPos, 1) Like "#" Then Exit Function Next GetNumPos = 0 ' no number found End Function
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.