Skip to main content

Hy, I'm using Rumba Scripting engine 9.4.0. I want to create a script where I return a custom type from a function. However I get an error when try to run this with the Scripting engine: "Error on line:16 - type mismatch". According to stackoverflow the code should work 

```

Type FullName
FirstName As String
LastName As String
End Type

Sub Main
Dim fullName As FullName
fullName = GetName()

MsgBox fullName.FirstName &" "& fullName.LastName

End Sub

Function GetName() As FullName
Dim temp As FullName
temp.FirstName = "John"
temp.LastName = "Doe"

GetName = temp

End Function

```


#Rumba

Hy, I'm using Rumba Scripting engine 9.4.0. I want to create a script where I return a custom type from a function. However I get an error when try to run this with the Scripting engine: "Error on line:16 - type mismatch". According to stackoverflow the code should work 

```

Type FullName
FirstName As String
LastName As String
End Type

Sub Main
Dim fullName As FullName
fullName = GetName()

MsgBox fullName.FirstName &" "& fullName.LastName

End Sub

Function GetName() As FullName
Dim temp As FullName
temp.FirstName = "John"
temp.LastName = "Doe"

GetName = temp

End Function

```


#Rumba

Robin_B,

While the Rumba Script Editor has many commands that are similar to VBA, you cannot use standard VBA code to create a script.  I don't believe you will be able to return a custom type in the manner you are attempting in your post.  Depending on what you are trying to do, we may have a better method to accomplish the task.  Contact our Customer Support team at

US Freephone:

1-800-632-6265

Email:

 
Thanks,
Jeff B